Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnswerUrl not called on origination #35

Closed
cwells opened this issue Aug 18, 2011 · 10 comments
Closed

AnswerUrl not called on origination #35

cwells opened this issue Aug 18, 2011 · 10 comments

Comments

@cwells
Copy link

cwells commented Aug 18, 2011

Call origination doesn't work because AnswerUrl is never called.

Sequence of events:

  1. Originate call to my cell phone
  2. Ringing URL is called
  3. Answer cell phone
  4. Call immediately hangs up
  5. Hangup URL is called

Application log:

[I 110819 00:40:27 web:1398] 200 POST /dialing (127.0.0.1) 32.37ms
[I 110819 00:40:27 app2:84] uuid: 4e6318c8-c9da-11e0-a7b2-ebaa5909aa51
[I 110819 00:40:28 web:1398] 200 POST /ringing (127.0.0.1) 0.99ms
[I 110819 00:40:38 web:1398] 200 POST /hangup (127.0.0.1) 1.02ms

I've tested this with my own application using the plivohelper-python library. Also tested directly against the Plivo REST API. Further tested with plivohelper-python/examples/example-call.py. Answer URL is never POSTed to on outbound calls. However, it's worth noting that Answer URL is POSTed to on inbound calls.

FreeSWITCH console below:

http://pastebin.com/rmgSgtWn

@cwells
Copy link
Author

cwells commented Aug 18, 2011

Also, here's the relevant snippet from plivo-rest.log:

2011-08-19 01:24:27,435 plivo-rest[13530]: INFO: 127.0.0.1 - - [2011-08-19 01:24:27] "POST /v0.1/Call/ HTTP/1.1" 200 118 "-" "-"

2011-08-19 01:24:28,297 plivo-rest[13530]: INFO: Call from 5031231234 to 5551231234 in EarlyMedia for RequestUUID 73d4d276-c9e0-11e0-a7b2-ebaa5909aa51

2011-08-19 01:24:28,302 plivo-rest[13530]: INFO: Sent to POST http://127.0.0.1:5000/ringing with {'Direction': 'outbound', 'From': '5031231234', 'To': '5551231234', 'RequestUUID': '73d4d276-c9e0-11e0-a7b2-ebaa5909aa51', 'CallUUID': '74585a9c-c9e0-11e0-88df-0bed8a011e6b', 'CallStatus': 'ringing'} -- Result: OK

2011-08-19 01:24:36,509 plivo-rest[13530]: INFO: Hangup for Outgoing CallUUID 74585a9c-c9e0-11e0-88df-0bed8a011e6b Completed, HangupCause NORMAL_CLEARING, RequestUUID 73d4d276-c9e0-11e0-a7b2-ebaa5909aa51

2011-08-19 01:24:36,515 plivo-rest[13530]: INFO: Sent to POST http://127.0.0.1:5000/hangup with {'Direction': 'outbound', 'From': '', 'ALegUUID': '74585a9c-c9e0-11e0-88df-0bed8a011e6b', 'HangupCause': 'NORMAL_CLEARING', 'To': '5551231234', 'CallUUID': '74585a9c-c9e0-11e0-88df-0bed8a011e6b', 'ALegRequestUUID': '73d4d276-c9e0-11e0-a7b2-ebaa5909aa51', 'RequestUUID': '73d4d276-c9e0-11e0-a7b2-ebaa5909aa51', 'CallStatus': 'completed'} -- Result: OK

@mike-plivo
Copy link
Member

Let's find the issue :

  1. stop plivo
    /path/to/plivo/bin/plivo stop

  2. reinstall plivo
    see http://www.plivo.org/get-started/

  3. run plivo in foreground/debug mode :

In one terminal :
cd /path/to/plivo
source bin/activate
bin/plivo-outbound

In a second terminal :
cd /path/to/plivo
source bin/activate
bin/plivo-rest

Now try to make call using REST api and check if you have any python traceback or if AnswerUrl is ok .

@cwells
Copy link
Author

cwells commented Aug 19, 2011

Okay, I followed your steps. Logs are below.

[root@plivo /]# cd /usr/local/plivo
[root@plivo plivo]# source bin/activate
(plivo)[root@plivo plivo]# bin/plivo-outbound 
2011-08-19 04:54:18,588 plivo-outbound[3435]: INFO: Starting ...
2011-08-19 04:54:18,588 plivo-outbound[3435]: WARNING: Logger <plivo.utils.logger.StdoutLogger object at 0xb7d6112c>
2011-08-19 04:54:18,588 plivo-outbound[3435]: INFO: Config : {'rest_server': {'GROUP': 'plivo', 'HTTP_ADDRESS': '127.0.0.1:8088', 'CALL_HEARTBEAT_URL': 'http://127.0.0.1:5000/heartbeat/', 'ALLOWED_IPS': '127.0.0.1', 'FS_INBOUND_PASSWORD': 'secret', 'FS_INBOUND_ADDRESS': 'x.x.x.223:8021', 'USER': 'plivo', 'LOG_LEVEL': 'DEBUG', 'SECRET_KEY': 'secret', 'LOG_FILE': '/usr/local/plivo/tmp/plivo-rest.log', 'LOG_TYPE': 'file'}, 'common': {'DEFAULT_ANSWER_URL': 'http://127.0.0.1:5000/answered/', 'AUTH_TOKEN': 'secret', 'DEFAULT_HTTP_METHOD': 'POST', 'AUTH_ID': 'secret', 'DEFAULT_HANGUP_URL': 'http://127.0.0.1:5000/hangup/'}, 'outbound_server': {'LOG_LEVEL': 'DEBUG', 'FS_OUTBOUND_ADDRESS': 'x.x.x.39:8084', 'USER': 'plivo', 'GROUP': 'plivo', 'LOG_FILE': '/usr/local/plivo/tmp/plivo-outbound.log', 'LOG_TYPE': 'file'}}
2011-08-19 04:54:18,588 plivo-outbound[3435]: INFO: Starting OutboundServer ...
2011-08-19 04:54:18,588 plivo-outbound[3435]: INFO: OutboundServer started at 'x.x.x.39:8084'
2011-08-19 04:55:27,807 plivo-outbound[3435]: INFO: (1) New request from ('x.x.x.223', 40373)
2011-08-19 04:55:27,808 plivo-outbound[3435]: DEBUG: (1) Execute: connect args=''
2011-08-19 04:55:27,815 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Channel-Channel-Progress-Media-Time': '1313715317403370', 'Caller-Screen-Bit': 'true', 'variable_is_outbound': 'true', 'Call-Direction': 'outbound', 'Event-Calling-Line-Number': '1797', 'Reply-Text': '+OK\n', 'variable_last_dtmf_duration': '5000', 'variable_call_uuid': 'e7450aa6-c9fd-11e0-a9ce-2774d72d506a', 'variable_freetdm_chan_number': '24', 'Channel-Channel-Created-Time': '1313715317403370', 'Event-Date-Timestamp': '1313715327809880', 'Event-Name': 'CHANNEL_DATA', 'Unique-ID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'Control': 'full', 'variable_ignore_early_media': 'true', 'Caller-Privacy-Hide-Number': 'false', 'Content-Type': 'command/reply', 'variable_endpoint_disposition': 'ANSWER', 'Event-Date-Local': '2011-08-18 17:55:27', 'Channel-Channel-Answered-Time': '1313715327801978', 'Event-Calling-Function': 'parse_command', 'variable_socket_host': 'x.x.x.39', 'Caller-Destination-Number': '5551112222', 'Caller-Profile-Index': '2', 'Channel-State': 'CS_EXECUTE', 'variable_plivo_app': 'true', 'Core-UUID': '175a3832-c9f0-11e0-a9ad-2774d72d506a', 'Caller-Profile-Created-Time': '1313715327801978', 'variable_channel_name': 'FreeTDM/1:24/5551112222', 'Caller-Channel-Answered-Time': '1313715327801978', 'Answer-State': 'answered', 'variable_plivo_answer_url': 'http://127.0.0.1:5000/answered', 'Caller-Context': 'default', 'variable_execute_on_answer': 'send_dtmf 1234567890', 'variable_max_forwards': '70', 'variable_read_codec': 'PCMU', 'Channel-Channel-Progress-Time': '0', 'Caller-Channel-Created-Time': '1313715317403370', 'Channel-Write-Codec-Rate': '8000', 'Channel-Context': 'default', 'variable_uuid': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'Channel-Channel-Transfer-Time': '0', 'Channel-Channel-Hangup-Time': '0', 'Event-Date-GMT': 'Fri, 19 Aug 2011 00:55:27 GMT', 'Caller-Channel-Progress-Media-Time': '1313715317403370', 'Channel-Read-Codec-Rate': '8000', 'Channel-Profile-Index': '2', 'Channel-Name': 'FreeTDM/1:24/5551112222', 'variable_hangup_after_bridge': 'true', 'Channel-Privacy-Hide-Name': 'false', 'Channel-State-Number': '4', 'Channel-Call-UUID': 'e7450aa6-c9fd-11e0-a9ce-2774d72d506a', 'variable_bridge_early_media': 'false', 'Caller-Dialplan': 'inline', 'variable_absolute_codec_string': 'PCMA', 'Caller-Source': 'src/switch_ivr_originate.c', 'Caller-Channel-Name': 'FreeTDM/1:24/5551112222', 'FreeSWITCH-IPv4': 'x.x.x.223', 'FreeSWITCH-IPv6': '::1', 'variable_originate_early_media': 'false', 'Channel-Dialplan': 'inline', 'variable_plivo_ring_url': 'http://127.0.0.1:5000/ringing', 'Caller-Privacy-Hide-Name': 'false', 'Caller-Channel-Transfer-Time': '0', 'variable_current_application': 'socket', 'Event-Calling-File': 'mod_event_socket.c', 'Channel-Destination-Number': '5551112222', 'Channel-Write-Codec-Name': 'PCMU', 'variable_current_application_data': 'x.x.x.39:8084 async full', 'Channel-Source': 'src/switch_ivr_originate.c', 'Channel-Profile-Created-Time': '1313715327801978', 'Caller-Unique-ID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'variable_pre_transfer_caller_id_number': '5551231234', 'Channel-Screen-Bit': 'true', 'variable_origination_caller_id_number': '5551231234', 'Presence-Call-Direction': 'outbound', 'Channel-Read-Codec-Name': 'PCMU', 'variable_write_rate': '8000', 'variable_plivo_request_uuid': 'e744de8c-c9fd-11e0-a784-25fe2cfb2ccc', 'variable_read_rate': '8000', 'Caller-Channel-Hangup-Time': '0', 'Channel-Channel-Name': 'FreeTDM/1:24/5551112222', 'Channel-Privacy-Hide-Number': 'false', 'variable_freetdm_span_number': '1', 'variable_direction': 'outbound', 'variable_freetdm_span_name': 'span1', 'variable_plivo_hangup_url': 'http://127.0.0.1:5000/hangup', 'Channel-Unique-ID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'variable_originate_timeout': '20', 'Socket-Mode': 'async', 'variable_write_codec': 'PCMU', 'Caller-Channel-Progress-Time': '0', 'FreeSWITCH-Hostname': 'or1.tmcallerid.com', 'Channel-Call-State': 'ACTIVE'}, body=>
2011-08-19 04:55:27,815 plivo-outbound[3435]: DEBUG: (1) Execute: resume args=''
2011-08-19 04:55:27,819 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK'}, body=>
2011-08-19 04:55:27,819 plivo-outbound[3435]: DEBUG: (1) Execute: linger args=''
2011-08-19 04:55:27,821 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK will linger'}, body=>
2011-08-19 04:55:27,821 plivo-outbound[3435]: DEBUG: (1) Execute: myevents json args=''
2011-08-19 04:55:27,823 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK Events Enabled'}, body=>
2011-08-19 04:55:27,823 plivo-outbound[3435]: DEBUG: (1) Execute: divert_events args='on'
2011-08-19 04:55:27,825 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK events diverted'}, body=>
2011-08-19 04:55:27,825 plivo-outbound[3435]: DEBUG: (1) Execute: event json args='CUSTOM conference::maintenance plivo::dial'
2011-08-19 04:55:27,827 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK event listener enabled json'}, body=>
2011-08-19 04:55:27,827 plivo-outbound[3435]: DEBUG: (1) Execute: set args=plivo_app=true, uuid='', lock=True, loops=1
2011-08-19 04:55:27,829 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK'}, body=>
2011-08-19 04:55:27,829 plivo-outbound[3435]: DEBUG: (1) Execute: set args=hangup_after_bridge=false, uuid='', lock=True, loops=1
2011-08-19 04:55:27,831 plivo-outbound[3435]: DEBUG: (1) Response: <CommandResponse headers={'Content-Type': 'command/reply', 'Reply-Text': '+OK'}, body=>
2011-08-19 04:55:27,831 plivo-outbound[3435]: DEBUG: (1) Releasing Connection ...
2011-08-19 04:55:27,831 plivo-outbound[3435]: DEBUG: (1) Releasing Connection Done
Traceback (most recent call last):
  File "/usr/local/plivo/lib/python2.7/site-packages/gevent/greenlet.py", line 467, in _notify_links
    link(self)
  File "/usr/local/plivo/src/plivo/src/plivo/core/freeswitch/outboundsocket.py", line 119, in do_handle
    self.handle_request(socket, address)
  File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundserver.py", line 143, in handle_request
    trace=self._trace
  File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 126, in __init__
    eventjson=True, pool_size=200, trace=trace)
  File "/usr/local/plivo/src/plivo/src/plivo/core/freeswitch/outboundsocket.py", line 38, in __init__
    self.run()
  File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 280, in run
    self._run()
  File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 306, in _run
    self.session_params['From'] = from_no.lstrip('+')
AttributeError: 'NoneType' object has no attribute 'lstrip'
Failed to notify link switch of <Greenlet at 0x978c3ec>
[root@plivo plivo]# source bin/activate
(plivo)[root@plivo plivo]# bin/plivo-rest
2011-08-19 04:54:55,341 plivo-rest[3469]: INFO: Starting ...
2011-08-19 04:54:55,341 plivo-rest[3469]: WARNING: Logger <plivo.utils.logger.StdoutLogger object at 0x9d87dcc>
2011-08-19 04:54:55,342 plivo-rest[3469]: INFO: Config : {'rest_server': {'GROUP': 'plivo', 'HTTP_ADDRESS': '127.0.0.1:8088', 'CALL_HEARTBEAT_URL': 'http://127.0.0.1:5000/heartbeat/', 'ALLOWED_IPS': '127.0.0.1', 'FS_INBOUND_PASSWORD': 'secret', 'FS_INBOUND_ADDRESS': 'x.x.x.223:8021', 'USER': 'plivo', 'LOG_LEVEL': 'DEBUG', 'SECRET_KEY': 'secret', 'LOG_FILE': '/usr/local/plivo/tmp/plivo-rest.log', 'LOG_TYPE': 'file'}, 'common': {'DEFAULT_ANSWER_URL': 'http://127.0.0.1:5000/answered/', 'AUTH_TOKEN': 'secret', 'DEFAULT_HTTP_METHOD': 'POST', 'AUTH_ID': 'secret', 'DEFAULT_HANGUP_URL': 'http://127.0.0.1:5000/hangup/'}, 'outbound_server': {'LOG_LEVEL': 'DEBUG', 'FS_OUTBOUND_ADDRESS': 'x.x.x.39:8084', 'USER': 'plivo', 'GROUP': 'plivo', 'LOG_FILE': '/usr/local/plivo/tmp/plivo-outbound.log', 'LOG_TYPE': 'file'}}
2011-08-19 04:54:55,354 plivo-rest[3469]: INFO: RESTServer starting ...
2011-08-19 04:54:55,354 plivo-rest[3469]: INFO: RESTServer started at: 'http://127.0.0.1:8088'
2011-08-19 04:54:55,355 plivo-rest[3469]: INFO: Trying to connect to FreeSWITCH at: x.x.x.223:8021
2011-08-19 04:54:55,360 plivo-rest[3469]: INFO: Connected to FreeSWITCH
2011-08-19 04:55:16,496 plivo-rest[3469]: INFO: 127.0.0.1 - - [2011-08-19 04:55:16] "POST /v0.1/Call HTTP/1.1" 301 271 "-" "-"

2011-08-19 04:55:16,502 plivo-rest[3469]: DEBUG: RESTAPI Call with [('SendDigits', u'1234567890'), ('HangupUrl', u'http://127.0.0.1:5000/hangup'), ('From', u'5551231234'), ('GatewayTimeouts', u'20'), ('GatewayRetries', u'1'), ('To', u'5551112222'), ('GatewayCodecs', u"'PCMA,PCMU'"), ('RingUrl', u'http://127.0.0.1:5000/ringing'), ('AnswerUrl', u'http://127.0.0.1:5000/answered'), ('ExtraDialString', u'hangup_after_bridge=true,bridge_early_media=false'), ('Gateways', u'freetdm/1/a/')]
2011-08-19 04:55:16,512 plivo-rest[3469]: INFO: 127.0.0.1 - - [2011-08-19 04:55:16] "POST /v0.1/Call/ HTTP/1.1" 200 118 "-" "-"

2011-08-19 04:55:17,409 plivo-rest[3469]: INFO: Call from 5551231234 to 5551112222 in EarlyMedia for RequestUUID e744de8c-c9fd-11e0-a784-25fe2cfb2ccc
2011-08-19 04:55:17,433 plivo-rest[3469]: INFO: Sent to POST http://127.0.0.1:5000/ringing with {'Direction': 'outbound', 'From': '5551231234', 'To': '5551112222', 'RequestUUID': 'e744de8c-c9fd-11e0-a784-25fe2cfb2ccc', 'CallUUID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'CallStatus': 'ringing'} -- Result: OK
2011-08-19 04:55:27,853 plivo-rest[3469]: INFO: Hangup for Outgoing CallUUID e7cd9948-c9fd-11e0-a9cf-2774d72d506a Completed, HangupCause NORMAL_CLEARING, RequestUUID e744de8c-c9fd-11e0-a784-25fe2cfb2ccc
2011-08-19 04:55:27,853 plivo-rest[3469]: DEBUG: Call Cleaned up for RequestUUID e744de8c-c9fd-11e0-a784-25fe2cfb2ccc
2011-08-19 04:55:27,858 plivo-rest[3469]: INFO: Sent to POST http://127.0.0.1:5000/hangup with {'Direction': 'outbound', 'From': '', 'ALegUUID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'HangupCause': 'NORMAL_CLEARING', 'To': '5551112222', 'CallUUID': 'e7cd9948-c9fd-11e0-a9cf-2774d72d506a', 'ALegRequestUUID': 'e744de8c-c9fd-11e0-a784-25fe2cfb2ccc', 'RequestUUID': 'e744de8c-c9fd-11e0-a784-25fe2cfb2ccc', 'CallStatus': 'completed'} -- Result: OK

@cwells
Copy link
Author

cwells commented Aug 19, 2011

Okay, I reviewed the code at the point of the exception and I see

    from_no = channel.get_header('Caller-Caller-ID-Number')

Before you spend a lot of time debugging this, let me verify that this variable isn't getting stripped out by our Sangoma drivers (Sangoma has omitted standard variables on us before). I've discovered in the past that some versions of Sangoma drivers would omit the CID on inbound calls, but I suppose it's also possible they are dropping it on outbound as well (although I'm surprised FreeSWITCH wouldn't keep track of it).

If this is the case, do you think it would be possible to repopulate this variable in the dialplan (assuming they have it stuffed in some other variable)?

@bevenky
Copy link
Member

bevenky commented Aug 19, 2011

We dont have access to Sangoma drivers. Can you check this at your end and report back which variable does the caller id come when using sangoma?

@cwells
Copy link
Author

cwells commented Aug 19, 2011

I inserted

self.log.warn (str (channel.get_headers ()))

at the appropriate point and got this output. 5551111111 is the outbound caller id, 5552222222 is the callee's number.

{
'Channel-Channel-Progress-Media-Time': '1313722887812347', 
'Caller-Screen-Bit': 'true', 
'variable_is_outbound': 'true', 
'Call-Direction': 'outbound', 
'Event-Calling-Line-Number': '1797', 
'Reply-Text': '+OK\n', 
'variable_last_dtmf_duration': '5000', 
'variable_call_uuid': '876eaf76-ca0f-11e0-9a0b-e345d972036b', 
'variable_freetdm_chan_number': '24', 
'Channel-Channel-Created-Time': '1313722887812347', 
'Event-Date-Timestamp': '1313722897978833', 
'Event-Name': 'CHANNEL_DATA', 
'Unique-ID': '881e555c-ca0f-11e0-9a0c-e345d972036b', 
'Control': 'full', 
'variable_ignore_early_media': 'true', 
'Caller-Privacy-Hide-Number': 'false', 
'Content-Type': 'command/reply', 
'variable_endpoint_disposition': 'ANSWER', 
'Event-Date-Local': '2011-08-18 20:01:37', 
'Channel-Channel-Answered-Time': '1313722897968835', 
'Event-Calling-Function': 'parse_command', 
'variable_socket_host': 'x.x.x.39', 
'Caller-Destination-Number': '5552222222', 
'Caller-Profile-Index': '2', 
'Channel-State': 'CS_EXECUTE', 
'variable_plivo_app': 'true', 
'Core-UUID': 'e35f7244-ca09-11e0-99d8-e345d972036b', 
'Caller-Profile-Created-Time': '1313722897968835', 
'variable_channel_name': 'FreeTDM/1:24/5552222222', 
'Caller-Channel-Answered-Time': '1313722897968835', 
'Answer-State': 'answered', 
'variable_plivo_answer_url': 'http://127.0.0.1:5000/answered', 
'Caller-Context': 'default', 
'variable_execute_on_answer': 'send_dtmf 1234567890',
'variable_max_forwards': '70', 
'variable_read_codec': 'PCMU', 
'Channel-Channel-Progress-Time': '0', 
'Caller-Channel-Created-Time': '1313722887812347', 
'Channel-Write-Codec-Rate': '8000', 
'Channel-Context': 'default', 
'variable_uuid': '881e555c-ca0f-11e0-9a0c-e345d972036b', 
'Channel-Channel-Transfer-Time': '0',
'Channel-Channel-Hangup-Time': '0', 
'Event-Date-GMT': 'Fri, 19 Aug 2011 03:01:37 GMT', 
'Caller-Channel-Progress-Media-Time': '1313722887812347', 
'Channel-Read-Codec-Rate': '8000', 
'Channel-Profile-Index': '2', 
'Channel-Name': 'FreeTDM/1:24/5552222222', 
'variable_hangup_after_bridge': 'true', 
'Channel-Privacy-Hide-Name': 'false', 
'Channel-State-Number': '4', 
'Channel-Call-UUID': '876eaf76-ca0f-11e0-9a0b-e345d972036b', 
'variable_bridge_early_media': 'false', 
'Caller-Dialplan': 'inline', 
'variable_absolute_codec_string': 'PCMA', 
'Caller-Source': 'src/switch_ivr_originate.c', 
'Caller-Channel-Name': 'FreeTDM/1:24/5552222222', 
'FreeSWITCH-IPv4': 'x.x.x.223', 
'FreeSWITCH-IPv6': '::1', 
'variable_originate_early_media': 'false', 
'Channel-Dialplan': 'inline', 
'variable_plivo_ring_url': 'http://127.0.0.1:5000/ringing', 
'Caller-Privacy-Hide-Name': 'false', 
'Caller-Channel-Transfer-Time': '0', 
'variable_current_application': 'socket', 
'Event-Calling-File': 'mod_event_socket.c', 
'Channel-Destination-Number': '5552222222', 
'Channel-Write-Codec-Name': 'PCMU', 
'variable_current_application_data': 'x.x.x.39:8084 async full', 
'Channel-Source': 'src/switch_ivr_originate.c', 
'Channel-Profile-Created-Time': '1313722897968835', 
'Caller-Unique-ID': '881e555c-ca0f-11e0-9a0c-e345d972036b', 
'variable_pre_transfer_caller_id_number': '5551111111', 
'Channel-Screen-Bit': 'true', 
'variable_origination_caller_id_number': '5551111111', 
'Presence-Call-Direction': 'outbound', 
'Channel-Read-Codec-Name': 'PCMU', 
'variable_write_rate': '8000', 
'variable_plivo_request_uuid': '876ebc82-ca0f-11e0-b2e4-e31a940d9a52', 
'variable_read_rate': '8000', 
'Caller-Channel-Hangup-Time': '0', 
'Channel-Channel-Name': 'FreeTDM/1:24/5552222222', 
'Channel-Privacy-Hide-Number': 'false', 
'variable_freetdm_span_number': '1', 
'variable_direction': 'outbound', 
'variable_freetdm_span_name': 'span1', 
'variable_plivo_hangup_url': 'http://127.0.0.1:5000/hangup', 
'Channel-Unique-ID': '881e555c-ca0f-11e0-9a0c-e345d972036b', 
'variable_originate_timeout': '20', 
'Socket-Mode': 'async', 
'variable_write_codec': 'PCMU', 
'Caller-Channel-Progress-Time': '0', 
'FreeSWITCH-Hostname': 'some.domain.com', 
'Channel-Call-State': 'ACTIVE'
}

In the case of originating an outbound call, am I assuming correctly that Caller-Caller-Id-Number should be 5551111111 (the originating ANI)?

@cwells
Copy link
Author

cwells commented Aug 19, 2011

Also, just to verify, I changed the code to this:

    from_no = channel.get_header('Caller-Caller-ID-Number')
    if not from_no:
        from_no = channel.get_header('variable_origination_caller_id_number')

and this resolves my issue.

That being said, this is clearly not the right solution. Sangoma has no plans to fix their current stack as they plan to release a new one "real soon now" (we've been hearing that for over a year). This being the case, and assuming that there will be other broken implementations, perhaps the best, most generic solution would be a configuration option to define these variable names (or at least a FreeSWITCH recipe for getting the variables populated, assuming that's possible).

@mike-plivo
Copy link
Member

Checked FS code, seems 'origination_caller_id_number' variable is set in originate command regardless of the endpoint type.
But 'Caller-Caller-ID-Number' event header is set regarding caller_profile C struct in channel endpoint type .
So yes it's probably a bug in freetdm or sangoma lib .

It's may be a problem in freetdm endpoint in Freeswitch ?

@cwells
Copy link
Author

cwells commented Aug 19, 2011

Maybe. Sangoma is largely responsible for freetdm as well, although they'd be much more likely to commit a fix, since freetdm is included in their future direction. I'll report the issue and see if I can get any attention.

Thanks for your help in tracking this down.

@bevenky
Copy link
Member

bevenky commented Aug 20, 2011

Closing this for now.

@bevenky bevenky closed this as completed Aug 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants