#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import sys
from ESL import *
con = ESLconnection("
127.0.0.1","8021","ClueCon")
#are we connected?
if con.connected:
con.events("plain", "all");
while 1:
#my $e = $con->recvEventTimed(100);
e = con.recvEvent()
if e:
s=e.serialize()
if s=="":
continue
else:
s2=s.split('\n')
mas={}
for i in s2:
if i!="":
st=i.strip().split(':')
mas[st[0].strip()]=st[1].strip()
if mas['Event-Name'] == 'CHANNEL_BRIDGE':
telefon=mas["Other-Leg-Destination-Number"][0:]
print telefon