freeswitch拨号计划中获取通道变量以及获取被叫/呼叫号码

Song • 1032次浏览 • 0个评论 • 2018-10-19 03:57:38

freeswitch拨号计划中,我们需要获取通道变量,比如用户呼入电话以后我们获取对方的电话号码以及获取我们的作席号码,我们可以使用

<action application="info" data="ERR"/>

输入所有的通道变量,输出如下:

Channel-State: [CS_EXECUTE]
Channel-Call-State: [RINGING]
Channel-State-Number: [4]
Channel-Name: [sofia/internal/1005@47.94.222.109:9060]
Unique-ID: [17450f85-fcdd-4811-ae7e-8db459c47c44]
Call-Direction: [inbound]
Presence-Call-Direction: [inbound]
Channel-HIT-Dialplan: [true]
Channel-Presence-ID: [1005@47.94.222.109]
Channel-Call-UUID: [17450f85-fcdd-4811-ae7e-8db459c47c44]
Answer-State: [ringing]
Caller-Direction: [inbound]
Caller-Logical-Direction: [inbound]
Caller-Username: [1005]
Caller-Dialplan: [XML]
Caller-Caller-ID-Name: [1005]
Caller-Caller-ID-Number: [1005]
Caller-Orig-Caller-ID-Name: [1005]
Caller-Orig-Caller-ID-Number: [1005]
Caller-Network-Addr: [61.149.4.189]
Caller-ANI: [1005]
Caller-Destination-Number: [9002]
Caller-Unique-ID: [17450f85-fcdd-4811-ae7e-8db459c47c44]
Caller-Source: [mod_sofia]
Caller-Context: [default]
Caller-Channel-Name: [sofia/internal/1005@47.94.222.109:9060]
Caller-Profile-Index: [1]
Caller-Profile-Created-Time: [1539919983080702]
Caller-Channel-Created-Time: [1539919983080702]
Caller-Channel-Answered-Time: [0]
Caller-Channel-Progress-Time: [0]
Caller-Channel-Progress-Media-Time: [0]
Caller-Channel-Hangup-Time: [0]
Caller-Channel-Transfer-Time: [0]
Caller-Channel-Resurrect-Time: [0]
Caller-Channel-Bridged-Time: [0]
Caller-Channel-Last-Hold: [0]
Caller-Channel-Hold-Accum: [0]
Caller-Screen-Bit: [true]
Caller-Privacy-Hide-Name: [false]
Caller-Privacy-Hide-Number: [false]
variable_direction: [inbound]
variable_uuid: [17450f85-fcdd-4811-ae7e-8db459c47c44]
variable_session_id: [10]
variable_sip_from_params: [transport=UDP]
variable_sip_from_user: [1005]
variable_sip_from_port: [9060]
variable_sip_from_uri: [1005@47.94.222.109:9060]
variable_sip_from_host: [47.94.222.109]
variable_video_media_flow: [disabled]
variable_audio_media_flow: [disabled]
variable_text_media_flow: [disabled]
variable_channel_name: [sofia/internal/1005@47.94.222.109:9060]
variable_sip_call_id: [GHfnZ-A2XTviMy90akWj2Q..]
variable_sip_local_network_addr: [47.94.222.109]
variable_sip_network_ip: [61.149.4.189]
variable_sip_network_port: [63790]
variable_sip_invite_stamp: [1539919983080702]
variable_sip_received_ip: [61.149.4.189]
variable_sip_received_port: [63790]
variable_sip_via_protocol: [udp]
variable_sip_authorized: [true]
variable_Event-Name: [REQUEST_PARAMS]
variable_Core-UUID: [346e8bbc-607e-43e6-ac9a-4d9b247161dc]
variable_FreeSWITCH-Hostname: [iZ2zedt5e7ronlirnw6vl3Z]
variable_FreeSWITCH-Switchname: [iZ2zedt5e7ronlirnw6vl3Z]
variable_FreeSWITCH-IPv4: [172.17.226.225]
variable_FreeSWITCH-IPv6: [::1]
variable_Event-Date-Local: [2018-10-19 11:33:03]
variable_Event-Date-GMT: [Fri, 19 Oct 2018 03:33:03 GMT]
variable_Event-Date-Timestamp: [1539919983080702]
variable_Event-Calling-File: [sofia.c]
variable_Event-Calling-Function: [sofia_handle_sip_i_invite]
variable_Event-Calling-Line-Number: [10304]
variable_Event-Sequence: [1305]
variable_sip_number_alias: [1005]
variable_sip_auth_username: [1005]
variable_sip_auth_realm: [47.94.222.109]
variable_number_alias: [1005]
variable_requested_user_name: [1005]
variable_requested_domain_name: [172.17.226.225]
variable_record_stereo: [true]
variable_default_gateway: [example.com]
variable_default_areacode: [918]
variable_transfer_fallback_extension: [operator]
variable_toll_allow: [domestic,international,local]
variable_accountcode: [1005]
variable_user_context: [default]
variable_effective_caller_id_name: [Extension 1005]
variable_effective_caller_id_number: [1005]
variable_outbound_caller_id_name: [FreeSWITCH]
variable_outbound_caller_id_number: [0000000000]
variable_callgroup: [techsupport]
variable_user_name: [1005]
variable_domain_name: [172.17.226.225]
variable_sip_from_user_stripped: [1005]
variable_sip_from_tag: [9232dc1d]
variable_sofia_profile_name: [internal]
variable_sofia_profile_url: [sip:mod_sofia@47.94.222.109:9060]
variable_recovery_profile_name: [internal]
variable_sip_full_via: [SIP/2.0/UDP 61.149.4.189:63790;branch=z9hG4bK-524287-1---0905f7e262e8ef36;rport=63790]
variable_sip_full_from: [<sip:1005@47.94.222.109:9060;transport=UDP>;tag=9232dc1d]
variable_sip_full_to: [<sip:9002@47.94.222.109:9060;transport=UDP>]
variable_sip_req_params: [transport=UDP]
variable_sip_req_user: [9002]
variable_sip_req_port: [9060]
variable_sip_req_uri: [9002@47.94.222.109:9060]
variable_sip_req_host: [47.94.222.109]
variable_sip_to_params: [transport=UDP]
variable_sip_to_user: [9002]
variable_sip_to_port: [9060]
variable_sip_to_uri: [9002@47.94.222.109:9060]
variable_sip_to_host: [47.94.222.109]
variable_sip_contact_params: [transport=UDP]
variable_sip_contact_user: [1005]
variable_sip_contact_port: [63790]
variable_sip_contact_uri: [1005@61.149.4.189:63790]
variable_sip_contact_host: [61.149.4.189]
variable_rtp_use_codec_string: [OPUS,G722,PCMU,PCMA,VP8]
variable_sip_user_agent: [Zoiper r55b5166]
variable_sip_via_host: [61.149.4.189]
variable_sip_via_port: [63790]
variable_sip_via_rport: [63790]
variable_max_forwards: [70]
variable_presence_id: [1005@47.94.222.109]
variable_switch_r_sdp: [v=0
o=Zoiper 0 0 IN IP4 192.168.0.117
s=Zoiper
c=IN IP4 192.168.0.117
t=0 0
m=audio 32142 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
]
variable_ep_codec_string: [CORE_PCM_MODULE.PCMU@8000h@20i@64000b,CORE_PCM_MODULE.PCMA@8000h@20i@64000b]
variable_endpoint_disposition: [DELAYED NEGOTIATION]
variable_DP_MATCH: [ARRAY::9002|:9002]
variable_call_uuid: [17450f85-fcdd-4811-ae7e-8db459c47c44]
variable_current_application: [info]

可以获取输出通道变量了,那么我们如何通过内置函数获取变量呢?方法如下:

<extension name="callin">
    <condition field="destination_number" expression="^(9002)$">
        <action application="info" data="ERR"/>
        <action application="log" data="ERR caller_id_number ${caller_id_number}"/>
        <action application="log" data="ERR caller_id_name ${caller_id_name}"/>
        <action application="log" data="ERR destination_number ${destination_number}"/>
        <action application="log" data="ERR channel_name ${channel_name}"/>
        <action application="log" data="ERR uuid ${uuid}"/>
    </condition>
</extension>

其中包含主叫号码(caller_id_number)、被叫号码(destination_number)、等。

提交评论
要回复文章请先登录注册
用户评论
  • 没有评论
    公告
    中国晚上好,随时随地分享前沿科技,好吃好玩,有趣有料的新鲜事;本站可以分享资源,技术,观点,态度;同时希望大家做一个文明的分享者!
    广告
    pytorch中文网