Outgoing Call Issue

I’ve got a CME registered to FreePBX. Calls from PSTN to CME (through FreePBX) work great. But, when I pick up a CME phone and try to dial out, I get “The number you have dialed is not in service. Please check the number and try again…” The log indicates

Received incoming SIP connection from unknown peer to 1760XXXXXXX <<-- My cell phone

I turned on “allow anonymous sip calls” to try to fix it, but no affect. I’ve seen plenty of posts where this is a problem coming from a provider, but my problem is the other way around. Regardless, the mentioned fixes haven’t had any affects. Can anyone give me an idea of where to look? Below is the config of my trunk in the “outgoing” section. The “incoming” and “registration” section is blank.

type=friend
host=dynamic
username=12XXX
secret=GOXXXXX
canreinvite=no
nat=no
qualify=yes
insecure=port,invite
dtmfmode=rfc2833

I think your issues are conceptual, you have created a peer and defined a username and a password yet you have also defined the peer as insecure (telling Asterisk to ignore the password). The config makes no sense so Asterisk might be acting in an odd way and not matching the peer.

You also did not define in incoming context so in the event the peer is matched Asterisk won’t know what to do with the call anyway.

An unknown peer error exists when Asterisk can’t match the received SIP invite with a configured peer. You simply do not have a peer that in Asterisk that matches what the CME is sending.

I ended up fixing it. I was testing the different “context” commands and found one that worked. Below is what I ended up using. It seems that when I want to tandem out through another trunk, the “context=from-internal” triggered it. I made sure I turned off “anonymous sip” to avoid toll fraud.

type=friend
host=dynamic
username=12XXX
secret=GOXXXXXXXX
canreinvite=no
nat=no
qualify=yes
insecure=port,invite
dtmfmode=rfc2833
context=from-internal

I am running into a similar issue, where all my calls are coming from unknown regardless of my context…
Maybe I’m stripping something from my voip peer on the CME side, and I would appreciate seeing a config that works!

Thank You

I know it is an obvious statement however the config that works is the simplest set of parameters that match the SIP invite from your peer.

Just look over the Asterisk sip.conf sample file for an explanation of all the keywords. Keep it simple. Less is more. If the IP is static and you trust the peer don’t bother with any authentication at all, IP is more than sufficient for identity.

Dear SkyKing,
Yes, you are right, and I tried to follow KISS.
I actually opened up another ticket in regards, as I cannot find anything wrong on the CME side, but for some reaosn my Asterisk is masking my CME as from-sip-external instead of the mapping I provided it…from-internal.

This gentleman’s resolution was my original implementation…
If you have time, :slight_smile:
http://www.freepbx.org/forum/general-help/contextfrominternal-not-being-applied-to-sip-trunk

-- Executing [[email protected]:5] Set("SIP/1000-00000004", "RT=15") in new stack
-- Executing [[email protected]:6] ExecIf("SIP/1000-00000004", "0?Macro(vm,1001,DIRECTDIAL,)") in new stack
-- Executing [[email protected]:7] ExecIf("SIP/1000-00000004", "0?MacroExit()") in new stack
-- Executing [[email protected]:8] Gosub("SIP/1000-00000004", "sub-record-check,s,1(exten,1001,)") in new stack
-- Executing [[email protected]:1] Set("SIP/1000-00000004", "REC_POLICY_MODE_SAVE=") in new stack
-- Executing [[email protected]:2] GotoIf("SIP/1000-00000004", "1?check") in new stack
-- Goto (sub-record-check,s,7)
-- Executing [[email protected]:7] Set("SIP/1000-00000004", "__MON_FMT=wav") in new stack
-- Executing [[email protected]:8] GotoIf("SIP/1000-00000004", "1?next") in new stack
-- Goto (sub-record-check,s,11)
-- Executing [[email protected]:11] ExecIf("SIP/1000-00000004", "0?Return()") in new stack
-- Executing [[email protected]:12] ExecIf("SIP/1000-00000004", "0?Set(__REC_POLICY_MODE=)") in new stack
-- Executing [[email protected]:13] GotoIf("SIP/1000-00000004", "0?exten,1") in new stack
-- Executing [[email protected]:14] Set("SIP/1000-00000004", "__REC_STATUS=INITIALIZED") in new stack
-- Executing [[email protected]:15] Set("SIP/1000-00000004", "NOW=1380799931") in new stack
-- Executing [[email protected]:16] Set("SIP/1000-00000004", "__DAY=03") in new stack
-- Executing [[email protected]:17] Set("SIP/1000-00000004", "__MONTH=10") in new stack
-- Executing [[email protected]:18] Set("SIP/1000-00000004", "__YEAR=2013") in new stack
-- Executing [[email protected]:19] Set("SIP/1000-00000004", "__TIMESTR=20131003-073211") in new stack
-- Executing [[email protected]:20] Set("SIP/1000-00000004", "__FROMEXTEN=1000") in new stack
-- Executing [[email protected]:21] Set("SIP/1000-00000004", "__CALLFILENAME=exten-1001-1000-20131003-073211-1380799931.4") in new stack
-- Executing [[email protected]:22] Goto("SIP/1000-00000004", "exten,1") in new stack
-- Goto (sub-record-check,exten,1)
-- Executing [[email protected]:1] GotoIf("SIP/1000-00000004", "0?callee") in new stack
-- Executing [[email protected]:2] Set("SIP/1000-00000004", "__REC_POLICY_MODE=dontcare") in new stack
-- Executing [[email protected]:3] GotoIf("SIP/1000-00000004", "1?caller") in new stack
-- Goto (sub-record-check,exten,10)
-- Executing [[email protected]:10] Set("SIP/1000-00000004", "__REC_POLICY_MODE=always") in new stack
-- Executing [[email protected]:11] GosubIf("SIP/1000-00000004", "1?record,1(exten,1001,1000)") in new stack
-- Executing [[email protected]:1] Set("SIP/1000-00000004", "AUDIOHOOK_INHERIT(MixMonitor)=yes") in new stack
-- Executing [[email protected]:2] MixMonitor("SIP/1000-00000004", "2013/10/03/exten-1001-1000-20131003-073211-1380799931.4.wav,,") in new stack
-- Executing [[email protected]:3] Set("SIP/1000-00000004", "__REC_STATUS=RECORDING") in new stack
-- Executing [[email protected]:4] Set("SIP/1000-00000004", "CDR(recordingfile)=exten-1001-1000-20131003-073211-1380799931.4.wav") in new stack
-- Executing [[email protected]:5] Return("SIP/1000-00000004", "") in new stack
-- Executing [[email protected]:12] Return("SIP/1000-00000004", "") in new stack
-- Executing [[email protected]:9] GotoIf("SIP/1000-00000004", "1?macrodial") in new stack
-- Goto (macro-exten-vm,s,15)
-- Executing [[email protected]:15] GosubIf("SIP/1000-00000004", "0?clrheader,1()") in new stack
-- Executing [[email protected]:16] Macro("SIP/1000-00000004", "dial-one,15,Ttr,1001") in new stack
-- Executing [[email protected]:1] Set("SIP/1000-00000004", "DEXTEN=1001") in new stack
-- Executing [[email protected]:2] Set("SIP/1000-00000004", "DIALSTATUS_CW=") in new stack
-- Executing [[email protected]:3] GosubIf("SIP/1000-00000004", "0?screen,1()") in new stack
-- Executing [[email protected]:4] GosubIf("SIP/1000-00000004", "0?cf,1()") in new stack
-- Executing [[email protected]:5] GotoIf("SIP/1000-00000004", "1?skip1") in new stack
-- Goto (macro-dial-one,s,8)
-- Executing [[email protected]:8] GotoIf("SIP/1000-00000004", "0?nodial") in new stack
-- Executing [[email protected]:9] GotoIf("SIP/1000-00000004", "0?continue") in new stack
-- Executing [[email protected]:10] Set("SIP/1000-00000004", "EXTHASCW=ENABLED") in new stack
-- Executing [[email protected]:11] GotoIf("SIP/1000-00000004", "0?next1:cwinusebusy") in new stack
-- Goto (macro-dial-one,s,23)
-- Executing [[email protected]:23] GotoIf("SIP/1000-00000004", "1?next3:continue") in new stack
-- Goto (macro-dial-one,s,24)
-- Executing [[email protected]:24] ExecIf("SIP/1000-00000004", "0?Set(DIALSTATUS_CW=BUSY)") in new stack
-- Executing [[email protected]:25] GotoIf("SIP/1000-00000004", "0?nodial") in new stack
-- Executing [[email protected]:26] GosubIf("SIP/1000-00000004", "1?dstring,1():dlocal,1()") in new stack
-- Executing [[email protected]:1] Set("SIP/1000-00000004", "DSTRING=") in new stack
-- Executing [[email protected]:2] Set("SIP/1000-00000004", "DEVICES=1001") in new stack
-- Executing [[email protected]:3] ExecIf("SIP/1000-00000004", "0?Return()") in new stack
-- Executing [[email protected]:4] ExecIf("SIP/1000-00000004", "0?Set(DEVICES=001)") in new stack
-- Executing [[email protected]:5] Set("SIP/1000-00000004", "LOOPCNT=1") in new stack
-- Executing [[email protected]:6] Set("SIP/1000-00000004", "ITER=1") in new stack
-- Executing [[email protected]:7] Set("SIP/1000-00000004", "THISDIAL=SIP/1001") in new stack
-- Executing [[email protected]:8] GosubIf("SIP/1000-00000004", "1?zap2dahdi,1()") in new stack
-- Executing [[email protected]:1] ExecIf("SIP/1000-00000004", "0?Return()") in new stack
-- Executing [[email protected]:2] Set("SIP/1000-00000004", "NEWDIAL=") in new stack
-- Executing [[email protected]:3] Set("SIP/1000-00000004", "LOOPCNT2=1") in new stack
-- Executing [[email protected]:4] Set("SIP/1000-00000004", "ITER2=1") in new stack
-- Executing [[email protected]:5] Set("SIP/1000-00000004", "THISPART2=SIP/1001") in new stack
-- Executing [[email protected]:6] ExecIf("SIP/1000-00000004", "0?Set(THISPART2=DAHDI/1001)") in new stack
-- Executing [[email protected]:7] Set("SIP/1000-00000004", "NEWDIAL=SIP/1001&") in new stack
-- Executing [[email protected]:8] Set("SIP/1000-00000004", "ITER2=2") in new stack
-- Executing [[email protected]:9] GotoIf("SIP/1000-00000004", "0?begin2") in new stack
-- Executing [[email protected]:10] Set("SIP/1000-00000004", "THISDIAL=SIP/1001") in new stack
-- Executing [[email protected]:11] Return("SIP/1000-00000004", "") in new stack
-- Executing [[email protected]:9] Set("SIP/1000-00000004", "DSTRING=SIP/1001&") in new stack
-- Executing [[email protected]:10] Set("SIP/1000-00000004", "ITER=2") in new stack
-- Executing [[email protected]:11] GotoIf("SIP/1000-00000004", "0?begin") in new stack
-- Executing [[email protected]:12] Set("SIP/1000-00000004", "DSTRING=SIP/1001") in new stack

== Begin MixMonitor Recording SIP/1000-00000004
– Executing [[email protected]:13] Return(“SIP/1000-00000004”, “”) in new stack
– Executing [[email protected]:27] GotoIf(“SIP/1000-00000004”, “0?nodial”) in new stack
– Executing [[email protected]:28] GotoIf(“SIP/1000-00000004”, “0?skiptrace”) in new stack
– Executing [[email protected]:29] GosubIf(“SIP/1000-00000004”, “1?ctset,1():ctclear,1()”) in new stack
– Executing [[email protected]:1] Set(“SIP/1000-00000004”, “DB(CALLTRACE/1001)=1000”) in new stack
– Executing [[email protected]:2] Return(“SIP/1000-00000004”, “”) in new stack
– Executing [[email protected]:30] Set(“SIP/1000-00000004”, “D_OPTIONS=Ttr”) in new stack
– Executing [[email protected]:31] ExecIf(“SIP/1000-00000004”, “0?SIPAddHeader(Alert-Info: )”) in new stack
– Executing [[email protected]:32] ExecIf(“SIP/1000-00000004”, “0?SIPAddHeader()”) in new stack
– Executing [[email protected]:33] ExecIf(“SIP/1000-00000004”, “0?Set(CHANNEL(musicclass)=)”) in new stack
– Executing [[email protected]:34] GosubIf(“SIP/1000-00000004”, “0?qwait,1()”) in new stack
– Executing [[email protected]:35] Set(“SIP/1000-00000004”, “__CWIGNORE=”) in new stack
– Executing [[email protected]:36] Set(“SIP/1000-00000004”, “__KEEPCID=TRUE”) in new stack
– Executing [[email protected]:37] GotoIf(“SIP/1000-00000004”, “0?usegoto,1”) in new stack
– Executing [[email protected]:38] GotoIf(“SIP/1000-00000004”, “0?godial”) in new stack
– Executing [[email protected]:39] Set(“SIP/1000-00000004”, “CONNECTEDLINE(name,i)=Rajkumar Parate”) in new stack
– Executing [[email protected]:40] Set(“SIP/1000-00000004”, “CONNECTEDLINE(num)=1001”) in new stack
– Executing [[email protected]:41] Set(“SIP/1000-00000004”, “D_OPTIONS=TtrI”) in new stack
– Executing [[email protected]:42] Dial(“SIP/1000-00000004”, “SIP/1001,15,TtrI”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/1001
– Connected line update to SIP/1000-00000004 prevented.
– SIP/1001-00000005 is ringing
– Connected line update to SIP/1000-00000004 prevented.
– SIP/1001-00000005 answered SIP/1000-00000004
[2013-10-03 07:32:20] WARNING[3479]: chan_sip.c:4174 retrans_pkt: Retransmission timeout reached on transmission OTMxMDc5MWU3YTcxYmU0ZGY2YjJhNjIyMDgzYjYyNGM for seqno 2 (Critical Response) – See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 6400ms with no response
[2013-10-03 07:32:20] WARNING[3479]: chan_sip.c:4203 retrans_pkt: Hanging up call OTMxMDc5MWU3YTcxYmU0ZGY2YjJhNjIyMDgzYjYyNGM - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
– Executing [[email protected]:1] Macro(“SIP/1000-00000004”, “hangupcall,”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/1000-00000004”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [[email protected]:3] ExecIf(“SIP/1000-00000004”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [[email protected]:4] Hangup(“SIP/1000-00000004”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/1000-00000004’ in macro ‘hangupcall’
== Spawn extension (macro-dial-one, h, 1) exited non-zero on ‘SIP/1000-00000004’
== Spawn extension (macro-dial-one, s, 42) exited non-zero on ‘SIP/1000-00000004’ in macro ‘dial-one’
== Spawn extension (macro-exten-vm, s, 16) exited non-zero on ‘SIP/1000-00000004’ in macro ‘exten-vm’
== Spawn extension (from-internal, 1001, 2) exited non-zero on ‘SIP/1000-00000004’
== MixMonitor close filestream (mixed)
== End MixMonitor Recording SIP/1000-00000004

---->
— (14 headers 0 lines) —
Really destroying SIP dialog ‘[email protected]:5060’ Method: OPTIONS
Reliably Transmitting (NAT) to 172.25.3.4:38890:
OPTIONS sip:[email protected]:38890;rinstance=84c8fd901b76f591 SIP/2.0
Via: SIP/2.0/UDP 172.25.1.115:5060;branch=z9hG4bK6791042a;rport
Max-Forwards: 70
From: “Unknown” sip:[email protected];tag=as5810814b
To: sip:[email protected]:38890;rinstance=84c8fd901b76f591
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.5.1)
Date: Thu, 03 Oct 2013 12:16:04 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:172.25.3.4:38890 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.25.1.115:5060;branch=z9hG4bK6791042a;rport=5060
Contact: sip:172.25.3.4:38890
To: sip:[email protected]:38890;rinstance=84c8fd901b76f591;tag=00bec27e
From: "Unknown"sip:[email protected];tag=as5810814b
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
Accept: application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Supported: replaces, eventlist
User-Agent: X-Lite release 4.5.2 stamp 70142
Allow-Events: hold, talk
Content-Length: 0

<------------->
— (14 headers 0 lines) —
Really destroying SIP dialog ‘[email protected]:5060’ Method: OPTIONS
Reliably Transmitting (NAT) to 202.54.112.194:5060:
OPTIONS sip:202.54.112.194 SIP/2.0
Via: SIP/2.0/UDP 172.25.1.115:5060;branch=z9hG4bK12b6af77;rport
Max-Forwards: 70
From: “Unknown” sip:[email protected];tag=as4bfcb07a
To: sip:202.54.112.194
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.5.1)
Date: Thu, 03 Oct 2013 12:16:04 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:202.54.112.194:5060 —>
SIP/2.0 200 OK
Session-Expires: 3600
Require: timer
Via: SIP/2.0/UDP 172.25.1.115:5060;rport=5060;received=172.25.1.115;branch=z9hG4bK12b6af77
To: sip:202.54.112.194;tag=3589791366-999145
From: “Unknown” sip:[email protected]:5060;tag=as4bfcb07a
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
Allow: INVITE, BYE, OPTIONS, CANCEL, ACK, REGISTER, NOTIFY, INFO, REFER, SUBSCRIBE, PRACK, UPDATE, MESSAGE, PUBLISH
Contact: sip:202.54.112.194:5060
Date: Thu, 03 Oct 2013 12:16:04 GMT
Content-Length: 0

<------------->
— (12 headers 0 lines) —
Really destroying SIP dialog ‘[email protected]:5060’ Method: OPTIONS

<— SIP read from UDP:172.25.3.3:10250 —>

<------------->

<— SIP read from UDP:172.25.3.4:38890 —>