Hi everybodyI have an asterisk(172.16.1.33) and freeswitch(172.16.1.30)My scenario :
- Calls come to freeswitch ivr menu
- In ivr calls transfer to asterisk after running an python script freeswitch start recording voice
- In asterisk calls push to an queue
my python script is :############################################################ import paramikohostname = '172.16.1.33'port = 3022username = 'root'pkey_file = '/root/.ssh/id_rsa'def get_agent_id(num):command="asterisk -rx \"pjsip show channels\" | grep -a1 \"CLCID: \\\"%s\\\"\" | grep Channel | cut -d \/ -f2 | cut -d\- -f1 " % (num)key = paramiko.RSAKey.from_private_key_file(pkey_file) s = paramiko.SSHClient()s.load_system_host_keys()s.connect(hostname, port, pkey=key)stdin, stdout, stderr = s.exec_command(command)result=str(stdout.read())s.close()return result#if __name__ == "__main__":# agent_id=get_agent_id('1000')# print (agent_id)import freeswitch as freeswitchdef handler(session, args):caller_num = session.getVariable("caller")agent_num = get_agent_id(caller_num)session.setVariable("AGENT_NUM", agent_num); session.setVariable("CALLER_NUM", caller_num); ############################################################ my dial plan is :############################################################ <extension name="test_dialplan"><condition field="destination_number" expression="^2605$"><action application="playback" data="phrase:shatel_before_queue"/> <action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/><action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/><action application="set" data="caller=${caller_id_number}"/> <action application="python" data="test"/><action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-% H-%M-%S)}_${destination_ number}_${caller_id_number}_${ AGENT_NUM}.wav"/> <action application="bridge" data="sofia/internal/261910@$${asterisk_vip}"/> </condition></extension>############################################################ MY PROBLEM IS:when i want to use my variable AGENT_NUM it is nullBUTwhen i use the python manually it returns true valueplease help me what is my mistake ??????
____________________________________________________________ _____________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch- users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/ options/freeswitch-users
http://www.freeswitch.org