Call cell phone with channel originate

I found a lot of CLIs on net and in this forum but none of them works for me.
e.g.:
channel originate local/[email protected] extension [email protected]

Did you actually look at the Wiki for the Originate command? The explanation there is pretty straightforward. In spite of that, let me help you a little.

channel originate <tech/data> extension [@][<context>]

What error are you getting in the /var/log/asterisk/full log?

This should actually work. Can you post a call log?

*CLI> channel originate local/[email protected] extension [email protected]
– Called [email protected]
– Executing [[email protected]:1] Macro(“Local/[email protected];2”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
– Executing [[email protected]:1] Set(“Local/[email protected];2”, “TOUCH_MONITOR=1594213294.163”) in new stack
– Executing [[email protected]:2] Set(“Local/[email protected];2”, “AMPUSER=”) in new stack
– Executing [[email protected]:3] GotoIf(“Local/[email protected];2”, “0?report”) in new stack
– Executing [[email protected]:4] ExecIf(“Local/[email protected];2”, “1?Set(REALCALLERIDNUM=)”) in new stack
– Executing [[email protected]:5] Set(“Local/[email protected];2”, “AMPUSER=”) in new stack
– Executing [[email protected]:6] GotoIf(“Local/[email protected];2”, “0?limit”) in new stack
– Executing [[email protected]:7] Set(“Local/[email protected];2”, “AMPUSERCIDNAME=”) in new stack
– Executing [[email protected]:8] ExecIf(“Local/[email protected];2”, “0?Set(__CIDMASQUERADING=TRUE)”) in new stack
– Executing [[email protected]:9] GotoIf(“Local/[email protected];2”, “1?report”) in new stack
– Goto (macro-user-callerid,s,17)
– Executing [[email protected]:17] NoOp(“Local/[email protected];2”, “Macro Depth is 1”) in new stack
– Executing [[email protected]:18] GotoIf(“Local/[email protected];2”, “1?report2:macroerror”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [[email protected]:19] GotoIf(“Local/[email protected];2”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,38)
– Executing [[email protected]:38] Set(“Local/[email protected];2”, “CALLERID(number)=”) in new stack
– Executing [[email protected]:39] Set(“Local/[email protected];2”, “CALLERID(name)=”) in new stack
– Executing [[email protected]:40] GotoIf(“Local/[email protected];2”, “1?cnum”) in new stack
– Goto (macro-user-callerid,s,42)
– Executing [[email protected]:42] Set(“Local/[email protected];2”, “CDR(cnum)=”) in new stack
– Executing [[email protected]:43] Set(“Local/[email protected];2”, “CHANNEL(language)=en”) in new stack
– Executing [[email protected]:2] Gosub(“Local/[email protected];2”, “sub-record-check,s,1(out,123456789,dontcare)”) in new stack
– Executing [[email protected]:1] GotoIf(“Local/[email protected];2”, “0?initialized”) in new stack
– Executing [[email protected]:2] Set(“Local/[email protected];2”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [[email protected]:3] Set(“Local/[email protected];2”, “NOW=1594213294”) in new stack
– Executing [[email protected]:4] Set(“Local/[email protected];2”, “__DAY=08”) in new stack
– Executing [[email protected]:5] Set(“Local/[email protected];2”, “__MONTH=07”) in new stack
– Executing [[email protected]:6] Set(“Local/[email protected];2”, “__YEAR=2020”) in new stack
– Executing [[email protected]:7] Set(“Local/[email protected];2”, “__TIMESTR=20200708-150134”) in new stack
– Executing [[email protected]:8] Set(“Local/[email protected];2”, “__FROMEXTEN=unknown”) in new stack
– Executing [[email protected]:9] Set(“Local/[email protected];2”, “__MON_FMT=wav”) in new stack
– Executing [[email protected]:10] NoOp(“Local/[email protected];2”, “Recordings initialized”) in new stack
– Executing [[email protected]:11] ExecIf(“Local/[email protected];2”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [[email protected]:12] Set(“Local/[email protected];2”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [[email protected]:13] ExecIf(“Local/[email protected];2”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [[email protected]:14] GotoIf(“Local/[email protected];2”, “3?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [[email protected]:17] GotoIf(“Local/[email protected];2”, “1?sub-record-check,out,1”) in new stack
– Goto (sub-record-check,out,1)
– Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Outbound Recording Check from unknown to 123456789”) in new stack
– Executing [[email protected]:2] Set(“Local/[email protected];2”, “RECMODE=”) in new stack
– Executing [[email protected]:3] ExecIf(“Local/[email protected];2”, “1?Goto(routewins)”) in new stack
– Goto (sub-record-check,out,7)
– Executing [[email protected]:7] Gosub(“Local/[email protected];2”, “recordcheck,1(dontcare,out,123456789)”) in new stack
– Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Starting recording check against dontcare”) in new stack
– Executing [[email protected]:2] Goto(“Local/[email protected];2”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [[email protected]:3] Return(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:8] Return(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:3] ExecIf(“Local/[email protected];2”, “0 ?Set(CDR(accountcode)=)”) in new stack
– Executing [[email protected]:4] Set(“Local/[email protected];2”, “MOHCLASS=default”) in new stack
– Executing [[email protected]:5] Set(“Local/[email protected];2”, “_NODEST=”) in new stack
– Executing [[email protected]:6] Macro(“Local/[email protected];2”, “dialout-trunk,2,123456789,off”) in new stack
– Executing [[email protected]:1] Set(“Local/[email protected];2”, “DIAL_TRUNK=2”) in new stack
– Executing [[email protected]:2] ExecIf(“Local/[email protected];2”, “0?Set(DIAL_OPTIONS=tr)”) in new stack
– Executing [[email protected]:3] GosubIf(“Local/[email protected];2”, “0?sub-pincheck,s,1()”) in new stack
– Executing [[email protected]:4] ExecIf(“Local/[email protected];2”, “0?Set(CALLERID(num)=)”) in new stack
– Executing [[email protected]:5] GotoIf(“Local/[email protected];2”, “0?disabletrunk,1”) in new stack
– Executing [[email protected]:6] Set(“Local/[email protected];2”, “DIAL_NUMBER=123456789”) in new stack
– Executing [[email protected]:7] Set(“Local/[email protected];2”, “DIAL_TRUNK_OPTIONS=Ttr”) in new stack
– Executing [[email protected]:8] Set(“Local/[email protected];2”, “OUTBOUND_GROUP=OUT_2”) in new stack
– Executing [[email protected]:9] Set(“Local/[email protected];2”, “DIAL_TRUNK_OPTIONS=T”) in new stack
– Executing [[email protected]:10] GotoIf(“Local/[email protected];2”, “0?nomax”) in new stack
– Executing [[email protected]:11] GotoIf(“Local/[email protected];2”, “0?chanfull”) in new stack
– Executing [[email protected]:12] GotoIf(“Local/[email protected];2”, “0?skipoutcid”) in new stack
– Executing [[email protected]:13] Macro(“Local/[email protected];2”, “outbound-callerid,2”) in new stack
– Executing [[email protected]rid:1] NoOp(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:2] NoOp(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:3] NoOp(“Local/[email protected];2”, “on”) in new stack
– Executing [[email protected]:4] ExecIf(“Local/[email protected];2”, “0?Set(CALLERPRES(name-pres)=)”) in new stack
– Executing [[email protected]:5] ExecIf(“Local/[email protected];2”, “0?Set(CALLERPRES(num-pres)=)”) in new stack
– Executing [[email protected]:6] ExecIf(“Local/[email protected];2”, “1?Set(REALCALLERIDNUM=)”) in new stack
– Executing [[email protected]:7] ExecIf(“Local/[email protected];2”, “0?Set(AMPUSER=unknown)”) in new stack
– Executing [[email protected]:8] GotoIf(“Local/[email protected];2”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [[email protected]:12] Set(“Local/[email protected];2”, “USEROUTCID=”) in new stack
– Executing [[email protected]:13] Set(“Local/[email protected];2”, “EMERGENCYCID=”) in new stack
– Executing [[email protected]:14] Set(“Local/[email protected];2”, “TRUNKOUTCID=”) in new stack
– Executing [[email protected]:15] GotoIf(“Local/[email protected];2”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,21)
– Executing [[email protected]:21] ExecIf(“Local/[email protected];2”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:22] ExecIf(“Local/[email protected];2”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:23] ExecIf(“Local/[email protected];2”, “0?Set(CALLERID(all)=)”) in new stack
– Executing [[email protected]:24] ExecIf(“Local/[email protected];2”, “0?Set(CALLERPRES(name-pres)=prohib_passed_screen)”) in new stack
– Executing [[email protected]:25] ExecIf(“Local/[email protected];2”, “0?Set(CALLERPRES(num-pres)=prohib_passed_screen)”) in new stack
– Executing [[email protected]:26] Set(“Local/[email protected];2”, “CDR(outbound_cnum)=”) in new stack
– Executing [[email protected]:27] Set(“Local/[email protected];2”, “CDR(outbound_cnam)=”) in new stack
– Executing [[email protected]:14] GosubIf(“Local/[email protected];2”, “1?sub-flp-2,s,1()”) in new stack
– Executing [[email protected]:1] ExecIf(“Local/[email protected];2”, “1?Return()”) in new stack
– Executing [[email protected]:15] Set(“Local/[email protected];2”, “OUTNUM=123456789”) in new stack
– Executing [[email protected]:16] Set(“Local/[email protected];2”, “custom=SIP/siptrunk”) in new stack
– Executing [[email protected]:17] ExecIf(“Local/[email protected];2”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)”) in new stack
– Executing [[email protected]:18] ExecIf(“Local/[email protected];2”, “0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))”) in new stack
– Executing [[email protected]:19] Macro(“Local/[email protected];2”, “dialout-trunk-predial-hook,”) in new stack
– Executing [[email protected]:1] MacroExit(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:20] GotoIf(“Local/[email protected];2”, “0?skipcrm”) in new stack
– Executing [[email protected]:21] Set(“Local/[email protected]nal-0000002a;2”, “__CRM_DIRECTION=OUTBOUND”) in new stack
– Executing [[email protected]:22] Set(“Local/[email protected];2”, “__CRM_DESTINATION=123456789”) in new stack
– Executing [[email protected]:23] Set(“Local/[email protected];2”, “__CRM_SOURCE=”) in new stack
– Executing [[email protected]:24] AGI(“Local/[email protected];2”, “sangomacrm.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
– <Local/[email protected];2>AGI Script sangomacrm.agi completed, returning 0
– Executing [[email protected]:25] Set(“Local/[email protected];2”, “CHANNEL(hangup_handler_push)=crm-hangup,s,1”) in new stack
– Executing [[email protected]:26] NoOp(“Local/[email protected];2”, “CRM Finished”) in new stack
– Executing [[email protected]:27] GotoIf(“Local/[email protected];2”, “0?bypass,1”) in new stack
– Executing [[email protected]:28] ExecIf(“Local/[email protected];2”, “0?Set(CONNECTEDLINE(num,i)=123456789)”) in new stack
– Executing [[email protected]:29] ExecIf(“Local/[email protected];2”, “0?Set(CONNECTEDLINE(name,i)=CID:)”) in new stack
– Executing [[email protected]:30] ExecIf(“Local/[email protected];2”, “0?Set(CONNECTEDLINE(name,i)=CID:(Hidden))”) in new stack
– Executing [[email protected]:31] GotoIf(“Local/[email protected];2”, “0?customtrunk”) in new stack
– Executing [[email protected]:32] Dial(“Local/[email protected];2”, “SIP/siptrunk/123456789,300,Tb(func-apply-sipheaders^s^1,(2))”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– SIP/siptrunk-0000004e Internal Gosub(func-apply-sipheaders,s,1(2)) start
– Executing [[email protected]:1] ExecIf(“SIP/siptrunk-0000004e”, “0?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)”) in new stack
– Executing [[email protected]:2] NoOp(“SIP/siptrunk-0000004e”, “Applying SIP Headers to channel SIP/siptrunk-0000004e”) in new stack
– Executing [[email protected]:3] Set(“SIP/siptrunk-0000004e”, “TECH=SIP”) in new stack
– Executing [[email protected]:4] Set(“SIP/siptrunk-0000004e”, “SIPHEADERKEYS=”) in new stack
– Executing [[email protected]:5] While(“SIP/siptrunk-0000004e”, “0”) in new stack
– Jumping to priority 11
– Executing [[email protected]:12] Return(“SIP/siptrunk-0000004e”, “”) in new stack
== Spawn extension (from-trunk, 123456789, 1) exited non-zero on ‘SIP/siptrunk-0000004e’
– SIP/siptrunk-0000004e Internal Gosub(func-apply-sipheaders,s,1(2)) complete GOSUB_RETVAL=
– Called SIP/siptrunk/123456789
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [[email protected]:33] NoOp(“Local/[email protected];2”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 1”) in new stack
– Executing [[email protected]:34] GotoIf(“Local/[email protected];2”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [[email protected]:1] Set(“Local/[email protected];2”, “RC=1”) in new stack
– Executing [[email protected]:2] Goto(“Local/[email protected];2”, “1,1”) in new stack
– Goto (macro-dialout-trunk,1,1)
– Executing [[email protected]:1] Goto(“Local/[email protected];2”, “s-INVALIDNMBR,1”) in new stack
– Goto (macro-dialout-trunk,s-INVALIDNMBR,1)
– Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Dial failed due to trunk reporting Address Incomplete - giving up”) in new stack
– Executing [[email protected]:2] Progress(“Local/[email protected];2”, “”) in new stack
– Executing [[email protected]:3] Playback(“Local/[email protected];2”, “ss-noservice,noanswer”) in new stack
– Local/[email protected];1 is making progress
– <Local/[email protected];2> Playing ‘ss-noservice.slin16’ (language ‘en’)
– Executing [[email protected]:4] Busy(“Local/[email protected];2”, “20”) in new stack
– Local/[email protected];1 is busy
== Spawn extension (macro-dialout-trunk, s-INVALIDNMBR, 4) exited non-zero on ‘Local/[email protected];2’ in macro ‘dialout-trunk’
== Spawn extension (from-internal, 123456789, 6) exited non-zero on ‘Local/[email protected];2’
– Executing [[email protected]:1] Macro(“Local/[email protected];2”, “hangupcall”) in new stack
– Executing [[email protected]:1] GotoIf(“Local/[email protected];2”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [[email protected]:3] ExecIf(“Local/[email protected];2”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [[email protected]:4] NoOp(“Local/[email protected];2”, " montior file= ") in new stack
– Executing [[email protected]:5] GotoIf(“Local/[email protected];2”, “1?skipagi”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [[email protected]:7] Hangup(“Local/[email protected];2”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘Local/[email protected];2’ in macro ‘hangupcall’
== Spawn extension (from-internal, h, 1) exited non-zero on ‘Local/[email protected];2’
– Local/[email protected];2 Internal Gosub(crm-hangup,s,1) start
– Executing [[email protected]:1] NoOp(“Local/[email protected];2”, “Sending Hangup to CRM”) in new stack
– Executing [[email protected]:2] NoOp(“Local/[email protected];2”, “HANGUP CAUSE: 17”) in new stack
– Executing [[email protected]:3] ExecIf(“Local/[email protected];2”, “0?Set(__CRM_VOICEMAIL=)”) in new stack
– Executing [[email protected]:4] NoOp(“Local/[email protected];2”, “MASTER CHANNEL: 1594213294.163 = 1594213294.163”) in new stack
– Executing [[email protected]:5] GotoIf(“Local/[email protected];2”, “0?return”) in new stack
– Executing [[email protected]:6] Set(“Local/[email protected];2”, “__CRM_HANGUP=1”) in new stack
– Executing [[email protected]:7] AGI(“Local/[email protected];2”, “sangomacrm.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
– <Local/[email protected];2>AGI Script sangomacrm.agi completed, returning 0
– Executing [[email protected]:8] Return(“Local/[email protected];2”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘Local/[email protected];2’
– Local/[email protected];2 Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=

1 - Unallocated (unassigned) number. This cause indicates that the destination requested by the calling user cannot be reached because, although the number is in a valid format, it is not currently assigned (allocated).

Do your outbound routes have a valid dial plan?

1 Like

Yes, I have a valid plan. If I call this mobile number on phone (ext. 36) it works well.

The Originate is working correctly and appears to be trying to dial out. There’s something about either the format of the phone number or the configuration of your outbound trunks that is causing this to jam up.

Try calling from your local extension and look at the half dozen lines before the “Called SIP…” line on the successful call and see if you can spot any differences.

I assume that the provider rejected the call because caller ID was invalid.
You can confirm that by typing
sip set debug on
at the Asterisk command prompt and making another test call.

I am guessing that channel originate doesn’t populate the caller ID from the extension’s Outbound CID. If you don’t care about it (main company number is acceptable), try putting that in the route CID (but with Override Extension off), or you could use a special route for the purpose.

A search may find a better solution, but my quick look showed only custom dial plan.

3 Likes

Hi,

Many thanks for your idea! I found the root cause based on your idea.

I entered extension number e.g. 36 in Route CID of Outbound Routes and set Override Extension to Yes. sip set debug on helped me a lot.
Now it works well.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.