futel / asteriskserver

SIP server for Futel
Creative Commons Zero v1.0 Universal
24 stars 7 forks source link

redirect call to sip dial from programmable voice on programmable voice calls #322

Open kra opened 4 years ago

kra commented 4 years ago

is this doable currently for a call coming on on PV we are paying for client-domain-asterisk legs on PV, and asterisk-elasticsip leg on elasticsip. Can we redirect to the PV origination SIP URI and avoid two of those legs?

kra commented 4 years ago

https://www.voip-info.org/asterisk-cmd-transfer/

if we transfer to the PV origination URI would the legs then be client-domain-origination with all asterisk legs shut down?

kra commented 4 years ago

current command same => n,Dial(SIP/${ARG1}@${outgoingchannel},,g${ARG2})

kra commented 4 years ago

asterisk dials out recipient answers recipient hangs up

direct linphone on VM

[Sep 6 02:58:47] VERBOSE[11153][C-00000005] pbx.c: Executing [s@macro-dial:3] Dial("SIP/620-00000007", "SIP/+1503XXXXXXX@twilio-termination,,g") in new stack [Sep 6 02:58:47] VERBOSE[11153][C-00000005] netsock2.c: Using SIP RTP CoS mark 5 [Sep 6 02:58:47] VERBOSE[11153][C-00000005] app_dial.c: Called SIP/+1503XXXXXXX@twilio-termination [Sep 6 02:58:49] VERBOSE[11153][C-00000005] app_dial.c: SIP/twilio-termination-00000008 is making progress passing it to SIP/620-00000007 [Sep 6 02:58:49] VERBOSE[11153][C-00000005] app_dial.c: SIP/twilio-termination-00000008 is ringing [Sep 6 02:58:52] VERBOSE[11153][C-00000005] app_dial.c: SIP/twilio-termination-00000008 answered SIP/620-00000007 [Sep 6 02:58:52] VERBOSE[11179][C-00000005] bridge_channel.c: Channel SIP/twilio-termination-00000008 joined 'simple_bridge' basic-bridge <3a197f52-bb92-40c9-9e0f-32f88455d72d> [Sep 6 02:58:52] VERBOSE[11153][C-00000005] bridge_channel.c: Channel SIP/620-00000007 joined 'simple_bridge' basic-bridge <3a197f52-bb92-40c9-9e0f-32f88455d72d> [Sep 6 02:58:56] VERBOSE[11179][C-00000005] bridge_channel.c: Channel SIP/twilio-termination-00000008 left 'native_rtp' basic-bridge <3a197f52-bb92-40c9-9e0f-32f88455d72d> [Sep 6 02:58:56] VERBOSE[11153][C-00000005] bridge_channel.c: Channel SIP/620-00000007 left 'native_rtp' basic-bridge <3a197f52-bb92-40c9-9e0f-32f88455d72d> [Sep 6 02:58:56] VERBOSE[11153][C-00000005] pbx.c: Executing [s@macro-dial:4] Macro("SIP/620-00000007", "metric,outgoing-dialstatus-ANSWER-twilio-termination") in new stack

linphone to twilio pv on prod

[Sep 6 15:48:40] VERBOSE[26807][C-0000069f] pbx.c: Executing [s@macro-dia l:3] Dial("SIP/700-00000b3e", "SIP/+1503XXXXXXX@twilio-termination,,g") in new stack [Sep 6 15:48:40] VERBOSE[26807][C-0000069f] netsock2.c: Using SIP RTP CoS mark 5 [Sep 6 15:48:40] VERBOSE[26807][C-0000069f] app_dial.c: Called SIP/+1503XXXXXXX@twilio-termination [Sep 6 15:48:44] VERBOSE[26807][C-0000069f] app_dial.c: SIP/twilio-termination-00000b3f is making progress passing it to SIP/700-00000b3e [Sep 6 15:48:49] VERBOSE[26807][C-0000069f] app_dial.c: SIP/twilio-termination-00000b3f answered SIP/700-00000b3e [Sep 6 15:48:49] VERBOSE[26830][C-0000069f] bridge_channel.c: Channel SIP/twilio-termination-00000b3f joined 'simple_bridge' basic-bridge [Sep 6 15:48:49] VERBOSE[26807][C-0000069f] bridge_channel.c: Channel SIP/700-00000b3e joined 'simple_bridge' basic-bridge [Sep 6 15:48:53] VERBOSE[26830][C-0000069f] bridge_channel.c: Channel SIP/twilio-termination-00000b3f left 'native_rtp' basic-bridge [Sep 6 15:48:53] VERBOSE[26807][C-0000069f] bridge_channel.c: Channel SIP/700-00000b3e left 'native_rtp' basic-bridge [Sep 6 15:48:53] VERBOSE[26807][C-0000069f] pbx.c: Executing [s@macro-dial:4] Macro("SIP/700-00000b3e", "metric,outgoing-dialstatus-ANSWER-twilio-termination") in new stack

kra commented 4 years ago

transfer is not relevant

can we return something from the original dial? If there was a way for asterisk to hang up and return the desired number for the twiml function to continue on to dial? looks like asterisk can only add sip headers to INVITE, not BYE

https://www.twilio.com/docs/voice/twiml/dial Twilio will make a GET or POST request to the action URL (if provided) when the call ends. Call flow will then continue, using the TwiML you send in response to that request. If you do not provide an action URL in your and the original caller is still on the line, Twilio will continue to render the original TwiML document.

kra commented 4 years ago

https://www.twilio.com/docs/voice/twiml/refer should we be doing this anyway?

can forward if we have a number https://www.twilio.com/labs/twimlets/forward

kra commented 4 years ago

would be nice to be less complicated, what we really want is the initial menu served by twiml user selects dial => dial directly user selects anything else => dial/refer to asterisk

the drawback of that is that the initial menu needs to be implemented in twiml for each version maybe we should just fall through to a twilio dialtone? twiml: initial connection => send user to asterisk asterisk: user selects dialtone => hang up twiml: after dial returns send user to dialtone asterisk should never hang up otherwise, make sure we go to busy at end of every non-dial call, is this a problem for voicemail? canned calls would still be using the current termination