With FreePBX Distro (SNG7-FPBX-64bit-1707-1), I’m building an IVR application where caller can call in and listen different categories of music. Everything seems fine for me with simple control logics in dialplan so far but one of the features of my application is allowing caller can send a music to their friend to listen to. I could gather a caller’s friend’s phone number and set it in variable of a context but I’m lost with how to tell Asterisk to place separate outgoing call to given SIP phone number from within an active incoming call and let the friend listen to the music dedicated. Because I’m new to IP PBX programming and, with Asterisk and FreePBX I seem have tones of documents and supports from the community, but by attempting to implement this feature for my application, it took me 3 days to research but no luck, that’s why I seek hints from the community. Please anybody give a clue to practically do this.
Please anybody help me with problem placing a separate outbound call with ORIGINATE from an active channel within dialplan. I encounter problem of chan_sip.c: Received response: "Forbidden" from '"Anonymous" ;tag=as5a35ce72' and not sure how to fix this. Here is the cmd in my context same => n(sendTheMusic),Originate(SIP/callcentric,exten,${FRIEND_NUMBER})
Thank you for letting me know that I didn’t use the cmd Originate correctly. I tried again as below line.
same => n(sendTheMusic),Originate(${CHANNEL},exten,send-music,${FRIEND_NUMBER},1)
With this line I go different error in the Asterisk logfile.
[2017-09-12 14:46:32] VERBOSE[180210][C-000000c3] pbx.c: Executing [1777xxxxxxx@9292-ivr:125] Originate(“SIP/callcentric1-000000c7”, “SIP/callcentric1-000000c7,exten,send-music,1777yyyyyyy,1”) in new stack
[2017-09-12 14:46:32] VERBOSE[180210][C-000000c3] netsock2.c: Using SIP RTP TOS bits 184
[2017-09-12 14:46:32] VERBOSE[180210][C-000000c3] netsock2.c: Using SIP RTP CoS mark 5
[2017-09-12 14:46:32] ERROR[180210][C-000000c3] netsock2.c: getaddrinfo(“callcentric1-000000c7”, “(null)”, …): Name or service not known
[2017-09-12 14:46:32] WARNING[180210][C-000000c3] chan_sip.c: No such host: callcentric1-000000c7
For testing purpose, the context is simple as below.
[send-music]
exten => s,1,Answer()
same => n, SayAlpha(Good afternoon)
same => n, SayDigits(123)
same => n, Hangup()
Could you please give me more hints or samples of correct use of the command?
tech_data - Channel technology and data for creating the outbound channel. For example, SIP/1234.
type - This should be ‘app’ or ‘exten’, depending on whether the outbound channel should be connected to an application or extension.
arg1 - If the type is ‘app’, then this is the application name. If the type is ‘exten’, then this is the context that the channel will be sent to.
arg2 - If the type is ‘app’, then this is the data passed as arguments to the application. If the type is ‘exten’, then this is the extension that the channel will be sent to.
arg3 - If the type is ‘exten’, then this is the priority that the channel is sent to. If the type is ‘app’, then this parameter is ignored.
I’m still unsuccessful with placing outbound call using Originate in dialplan. I’m using SIP numbers from Callcentric. This is the command format I tried.
same => n(sendTheMusic),Originate(SIP/${FRIEND_NUMBER}@callcentric.com,exten,s@send-music)
And I have the lines below in log file.
[2017-09-13 06:17:59] VERBOSE[127877] dial.c: Called [email protected]
[2017-09-13 06:18:00] NOTICE[3987][C-000000c8] chan_sip.c: Failed to authenticate on INVITE to ‘“Anonymous” sip:[email protected]:5160;tag=as7ba347d8’
[2017-09-13 06:18:00] VERBOSE[127877] dial.c: SIP/callcentric.com-000000ce is circuit-busy
You don’t originate to ###@callcentric.com, you want to use the actual trunk name you have set up in FreePBX, something like SIP/callcentric/${FRIEND_NUMBER}. The actual trunk name you are using will be shown in ‘sip show peers’.
Thank you for providing alternative workaround to place an outbound call from active channel. On my asterisk server in development of an IVR application, I configured to test with Callcentric trunk name using FreePBX by following this guide on Callcentric. The sip show peers lists the following result:
And still I get no luck, with following logged.
[2017-09-13 15:21:18] VERBOSE[8861][C-000000cd] pbx.c: Executing [17778960612@9292-ivr:125] Originate(“SIP/callcentric18-000000d6”, “SIP/callcentric/1777MYCCID/17778673755,exten,s@send-music”) in new stack
[2017-09-13 15:21:18] ERROR[8861][C-000000cd] netsock2.c: getaddrinfo(“17778673755”, “(null)”, …): Name or service not known
[2017-09-13 15:21:18] WARNING[8861][C-000000cd] acl.c: Unable to lookup ‘17778673755’
[2017-09-13 15:21:18] WARNING[8861][C-000000cd] chan_sip.c: Unable to locate host ‘17778673755’
[2017-09-13 15:21:18] VERBOSE[8861][C-000000cd] netsock2.c: Using SIP RTP TOS bits 184
[2017-09-13 15:21:18] VERBOSE[8861][C-000000cd] netsock2.c: Using SIP RTP CoS mark 5
[2017-09-13 15:21:18] WARNING[9021] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument
[2017-09-13 15:21:18] VERBOSE[9021] dial.c: Called callcentric/1777MYCCID/17778673755
[2017-09-13 15:21:18] WARNING[3987] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument
[2017-09-13 15:21:19] WARNING[3987] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument
[2017-09-13 15:21:21] WARNING[3987] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument
[2017-09-13 15:21:25] WARNING[3987] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument
[2017-09-13 15:21:33] WARNING[3987] chan_sip.c: sip_xmit of 0x7fc9fc0035c0 (len 865) to (null) returned -1: Invalid argument