Outgoing calls are routed back to internal extension

Hi, I’m new to Asterisk and I just installed freepbx 2.10.
I have 2 trunks, 20 extensions, inbound and outbound routes and main IVR set-up on the server.
I can receive incoming calls from outside and the call gets routed properly to the main IVR (tested with my cellphone).

The problem is when I dial an outside number (local or 800)from one of the extension, the call gets routed to my default IVR, extension or whatever I set it to at the inbound route as if I was dialing my own phone number.

Any help, ideas or direction would be greatly appreciated.

sorry guys, I have a deferment problem now, I can’t login to the admin portal.
I think I’m going to re-install and start over and use your time more effectively.

Anyone?

You’d need to post some of your information for us to see what’s happening. Trunk settings (minus confidential information) and outbound routes for example would be helpful. OR you could post the part of the log file that shows the call progress.

With no information being provided there’s not much anyone can do.

Thanks for the help.
Basically I have 8 sip trunks and 2 PSTN with a local provider
5 trunks with easyofficephone.ca and 3 with bandwidth.com.

Bandwidth:
host=IP ADDRESS
type=peer
DTMF=rfc2833
disallow=all
allow=ulaw

Bandwidth incoming:
host= IP ADDRESS
Type=peer

Easyofficephone:
host=DOMAIN NAME
user=USERNAME
password=*******
type=peer
fromuser=USERNAME

incoming:
host=DOMAIN NAME
user=USERNAME
password=*******
type=peer

sorry I cant copy the errors from my log file,(the Master log file is empty??) I took the server offline and put the old one back to get us through the day.
I’m in the process of purchasing a sip trunk with deferment provider for testing purposes so I can have both servers on-line.
at the end of the day today I will put the server back online and hopefully get some more info for you.

when I change the extension’s context to from-trunk, I can get out on the PSTN line and some times on Bandwidth trunk.
The support person from Bandwidth traced the call I made and he said that I wasn’t using E164 format(did not set this up with the old Asterisk server) and didn’t have time to find out how to change the call format.
and can’t get out on the Easyofficephone trunk, the call get routed back to my IVR.

when I change the extension context to From-internal I get the message “all circuits are busy” on all trunks.

Below is part of my extensions.conf

; from-trunk:
;
; Context is really just an aliax of from-pstn
;
[from-trunk]
include => from-pstn
include => from-sip-external

; from-pstn:
;
; Entry context for calls from the outside world to hit FreePBX
[from-pstn]
include => from-pstn-custom ; create this context in extensions_custom.conf to include customizations
include => ext-did
include => ext-did-post-custom
include => from-did-direct
include => ext-did-catchall ; THIS MUST COME AFTER ext-did

; from-pstn-e164-us:
;
; The context is designed for providers who send calls in e164 format and is
; biased towards NPA calls, callerid and dialing rules. It will do the following:
;
; DIDs in an NPA e164 format of +1NXXNXXXXXX will be converted to 10 digit DIDs
;
; DIDs in any other format will be delivered as they are, including e164 non NPA
; DIDs which means they will need the full format including the + in the inbound
; route.
;
; CallerID(number) presented in e164 NPA format will be trimmed to a 10 digit CID
;
; CallerID(number) presented in e164 non-NPA (country code other than 1) will be
; reformated from: + to 011
;
[from-pstn-e164-us]
exten => +1NXXNXXXXXX/+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _+1NXXNXXXXXX/_NXXNXXXXXX,2,Goto(from-pstn,${EXTEN:2},1)
exten => +1NXXNXXXXXX/+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _+1NXXNXXXXXX/_011X.,n,Goto(from-pstn,${EXTEN:2},1)
exten => _+1NXXNXXXXXX,1,Goto(from-pstn,${EXTEN:2},1)
exten => [0-9+]./+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => _[0-9+]./_NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => [0-9+]./+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => _[0-9+]./_011X.,n,Goto(from-pstn,${EXTEN},1)
exten => [0-9+].,1,Goto(from-pstn,${EXTEN},1)
exten => s/
+1NXXNXXXXXX,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => s/NXXNXXXXXX,n,Goto(from-pstn,${EXTEN},1)
exten => s/
+X.,1,Set(CALLERID(number)=011${CALLERID(number):1})
exten => s/_011X.,n,Goto(from-pstn,${EXTEN},1)
exten => s,1,Goto(from-pstn,${EXTEN},1)

;-------------------------------------------------------------------------------
; from-internal:
;
; Internal dialplan that most internal phones have access to
;
[from-internal]
include => from-internal-noxfer
include => from-internal-xfer
include => bad-number ; auto-generated
;-------------------------------------------------------------------------------

;-------------------------------------------------------------------------------
; from-internal-noxfer:
;
; Place to put internal dialplan that should not be accessible during a blind
; transfer, this context will not be visible during such.
;
[from-internal-noxfer]
include => from-internal-noxfer-custom
; from-internal:
;
; Internal dialplan that most internal phones have access to
;
[from-internal]
include => from-internal-noxfer
include => from-internal-xfer
include => bad-number ; auto-generated
include => from-internal-noxfer-additional ; auto-generated
;-------------------------------------------------------------------------------

;-------------------------------------------------------------------------------
; from-internal-xfer:
;
; Place to put most internal dialplan, will be visible during normal calls and
; blind transfers.
;
[from-internal-xfer]
include => from-internal-custom
include => from-internal-additional ; auto-generated

I hope this helps.
thanks for your help.

Wilson.

not that, post just make a call where this is happening and then post a call trace of that call from the CLI, make sure you set verbosity of the CLI to 3 or higher.

Thanks Philippe, I will do that at the end of the day today when I put the system back online, for now I’m running the old Asterisk and I loos connection to my SIP providers as soon as I plug in the FreePBX server.

sorry it took so long, so, I re-installed FreePBX, setup 3 extensions, 1 trunk (bandwidth), in and out-bound routes.
I can receive calls (no audio) but no outgoing calls.
the support person from bandwidth said that our server is connected to them and there is nothing else he can do for me as far as troubleshooting.

I traced a call from call from ext 213 to 9052286888 (see below).
hope this helps.

=========================================================================
== Parsing ‘/etc/asterisk/asterisk.conf’: == Found
Connected to Asterisk 1.8.16.0 currently running on alex (pid = 3096)
Verbosity is at least 5
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “__RINGTIMER=15”) in new stack
– Executing [[email protected]:2] Macro(“SIP/213-00000019”, “exten-vm,novm,213,0,0,0”) in new stack
– Executing [[email protected]:1] Macro(“SIP/213-00000019”, “user-callerid,”) in new stack
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “AMPUSER=213”) in new stack
– Executing [[email protected]:2] GotoIf(“SIP/213-00000019”, “0?report”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/213-00000019”, “1?Set(REALCALLERIDNUM=213)”) in new stack
– Executing [[email protected]:4] Set(“SIP/213-00000019”, “AMPUSER=213”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “AMPUSERCIDNAME=213”) in new stack
– Executing [[email protected]:6] GotoIf(“SIP/213-00000019”, “0?report”) in new stack
– Executing [[email protected]:7] Set(“SIP/213-00000019”, “AMPUSERCID=213”) in new stack
– Executing [[email protected]:8] Set(“SIP/213-00000019”, “CALLERID(all)=“213” <213>”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/213-00000019”, “0?limit”) in new stack
– Executing [[email protected]:10] ExecIf(“SIP/213-00000019”, “0?Set(GROUP(concurrency_limit)=213)”) in new stack
– Executing [[email protected]:11] GosubIf(“SIP/213-00000019”, “7?sub-ccss,s,1(macro-exten-vm,213)”) in new stack
– Executing [[email protected]:1] ExecIf(“SIP/213-00000019”, “0?Return()”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “CCSS_SETUP=TRUE”) in new stack
– Executing [[email protected]:3] GosubIf(“SIP/213-00000019”, “0?monitor_config,1(macro-exten-vm,213):monitor_default,1(macro-exten-vm,213)”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/213-00000019”, “1?is_exten”) in new stack
– Goto (sub-ccss,monitor_default,4)
– Executing [[email protected]:4] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_monitor_policy)=generic”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_max_monitors)=5”) in new stack
– Executing [[email protected]:6] Return(“SIP/213-00000019”, “TRUE”) in new stack
– Executing [[email protected]:4] GosubIf(“SIP/213-00000019”, “7?agent_config,1():agent_default,1()”) in new stack
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_agent_policy)=generic”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_offer_timer)=30”) in new stack
– Executing [[email protected]:3] Set(“SIP/213-00000019”, “CALLCOMPLETION(ccbs_available_timer)=”) in new stack
[2012-10-03 12:51:27] WARNING[7512]: ccss.c:931 ast_set_ccbs_available_timer: 0 is an invalid value for ccbs_available_timer. Retaining value as 4800
– Executing [[email protected]:4] Set(“SIP/213-00000019”, “CALLCOMPLETION(ccnr_available_timer)=”) in new stack
[2012-10-03 12:51:27] WARNING[7512]: ccss.c:901 ast_set_ccnr_available_timer: 0 is an invalid value for ccnr_available_timer. Retaining value as 7200
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_callback_macro)=ccss-default”) in new stack
– Executing [agent_confi[email protected]:6] ExecIf(“SIP/213-00000019”, “1?Set(CALLCOMPLETION(cc_recall_timer)=)”) in new stack
[2012-10-03 12:51:27] WARNING[7512]: ccss.c:916 ast_set_cc_recall_timer: 0 is an invalid value for ccnr_available_timer. Retaining value as 20
– Executing [[email protected]:7] ExecIf(“SIP/213-00000019”, “1?Set(CALLCOMPLETION(cc_max_agents)=)”) in new stack
– Executing [[email protected]:8] ExecIf(“SIP/213-00000019”, “0?Set(CALLCOMPLETION(cc_agent_dialstring)=Local/[email protected])”) in new stack
– Executing [[email protected]:9] Set(“SIP/213-00000019”, “CALLCOMPLETION(cc_callback_macro)=ccss-default”) in new stack
– Executing [[email protected]:10] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “DB(AMPUSER/213/ccss/last_number)=213”) in new stack
– Executing [[email protected]:6] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:12] ExecIf(“SIP/213-00000019”, “0?Set(CHANNEL(language)=)”) in new stack
– Executing [[email protected]:13] GotoIf(“SIP/213-00000019”, “0?continue”) in new stack
– Executing [[email protected]:14] Set(“SIP/213-00000019”, “__TTL=64”) in new stack
– Executing [[email protected]:15] GotoIf(“SIP/213-00000019”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,26)
– Executing [[email protected]:26] Set(“SIP/213-00000019”, “CALLERID(number)=213”) in new stack
– Executing [[email protected]:27] Set(“SIP/213-00000019”, “CALLERID(name)=213”) in new stack
– Executing [[email protected]:28] Set(“SIP/213-00000019”, “CHANNEL(language)=en”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “RingGroupMethod=none”) in new stack
– Executing [[email protected]:3] Set(“SIP/213-00000019”, “__EXTTOCALL=213”) in new stack
– Executing [[email protected]:4] Set(“SIP/213-00000019”, “__PICKUPMARK=213”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “RT=”) in new stack
– Executing [[email protected]:6] Gosub(“SIP/213-00000019”, “sub-record-check,s,1(exten,213,)”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/213-00000019”, “1?check”) in new stack
– Goto (sub-record-check,s,6)
– Executing [[email protected]:6] Set(“SIP/213-00000019”, “__MON_FMT=wav”) in new stack
– Executing [[email protected]:7] GotoIf(“SIP/213-00000019”, “1?next”) in new stack
– Goto (sub-record-check,s,10)
– Executing [[email protected]:10] ExecIf(“SIP/213-00000019”, “0?Return()”) in new stack
– Executing [[email protected]:11] GotoIf(“SIP/213-00000019”, “0?exten,1”) in new stack
– Executing [[email protected]:12] Set(“SIP/213-00000019”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [[email protected]:13] ExecIf(“SIP/213-00000019”, “0?Set(__REC_POLICY_MODE=)”) in new stack
– Executing [[email protected]:14] Set(“SIP/213-00000019”, “NOW=1349283087”) in new stack
– Executing [[email protected]:15] Set(“SIP/213-00000019”, “__DAY=03”) in new stack
– Executing [[email protected]:16] Set(“SIP/213-00000019”, “__MONTH=10”) in new stack
– Executing [[email protected]:17] Set(“SIP/213-00000019”, “__YEAR=2012”) in new stack
– Executing [[email protected]:18] Set(“SIP/213-00000019”, “__TIMESTR=20121003-125127”) in new stack
– Executing [[email protected]:19] Set(“SIP/213-00000019”, “__FROMEXTEN=213”) in new stack
– Executing [[email protected]:20] Set(“SIP/213-00000019”, “__CALLFILENAME=exten-213-213-20121003-125127-1349283087.25”) in new stack
– Executing [[email protected]:21] Goto(“SIP/213-00000019”, “exten,1”) in new stack
– Goto (sub-record-check,exten,1)
– Executing [[email protected]ecord-check:1] GotoIf(“SIP/213-00000019”, “0?callee”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “__REC_POLICY_MODE=dontcare”) in new stack
– Executing [[email protected]:3] GotoIf(“SIP/213-00000019”, “1?caller”) in new stack
– Goto (sub-record-check,exten,10)
– Executing [[email protected]:10] Set(“SIP/213-00000019”, “REC_POLICY_MODE=dontcare”) in new stack
– Executing [[email protected]:11] GosubIf(“SIP/213-00000019”, “0?record,1(exten,213,213)”) in new stack
– Executing [[email protected]:12] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:7] GotoIf(“SIP/213-00000019”, “1?macrodial”) in new stack
– Goto (macro-exten-vm,s,13)
– Executing [[email protected]:13] GosubIf(“SIP/213-00000019”, “0?clrheader,1()”) in new stack
– Executing [[email protected]:14] Macro(“SIP/213-00000019”, “dial-one,tr,213”) in new stack
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “DEXTEN=213”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “DIALSTATUS_CW=”) in new stack
– Executing [[email protected]:3] GosubIf(“SIP/213-00000019”, “0?screen,1()”) in new stack
– Executing [[email protected]:4] GosubIf(“SIP/213-00000019”, “0?cf,1()”) in new stack
– Executing [[email protected]:5] GotoIf(“SIP/213-00000019”, “1?skip1”) in new stack
– Goto (macro-dial-one,s,8)
– Executing [[email protected]:8] GotoIf(“SIP/213-00000019”, “0?nodial”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/213-00000019”, “0?continue”) in new stack
– Executing [[email protected]:10] Set(“SIP/213-00000019”, “EXTHASCW=ENABLED”) in new stack
– Executing [[email protected]:11] GotoIf(“SIP/213-00000019”, “0?next1:cwinusebusy”) in new stack
– Goto (macro-dial-one,s,23)
– Executing [[email protected]:23] GotoIf(“SIP/213-00000019”, “1?next3:continue”) in new stack
– Goto (macro-dial-one,s,24)
– Executing [[email protected]:24] ExecIf(“SIP/213-00000019”, “1?Set(DIALSTATUS_CW=BUSY)”) in new stack
– Executing [[email protected]:25] GotoIf(“SIP/213-00000019”, “0?nodial”) in new stack
– Executing [[email protected]:26] GosubIf(“SIP/213-00000019”, “1?dstring,1():dlocal,1()”) in new stack
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “DSTRING=”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “DEVICES=213”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/213-00000019”, “0?Return()”) in new stack
– Executing [[email protected]:4] ExecIf(“SIP/213-00000019”, “0?Set(DEVICES=13)”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “LOOPCNT=1”) in new stack
– Executing [[email protected]:6] Set(“SIP/213-00000019”, “ITER=1”) in new stack
– Executing [[email protected]:7] Set(“SIP/213-00000019”, “THISDIAL=SIP/213”) in new stack
– Executing [[email protected]:8] GosubIf(“SIP/213-00000019”, “1?zap2dahdi,1()”) in new stack
– Executing [[email protected]:1] ExecIf(“SIP/213-00000019”, “0?Return()”) in new stack
– Executing [[email protected]:2] Set(“SIP/213-00000019”, “NEWDIAL=”) in new stack
– Executing [[email protected]:3] Set(“SIP/213-00000019”, “LOOPCNT2=1”) in new stack
– Executing [[email protected]:4] Set(“SIP/213-00000019”, “ITER2=1”) in new stack
– Executing [[email protected]:5] Set(“SIP/213-00000019”, “THISPART2=SIP/213”) in new stack
– Executing [[email protected]:6] ExecIf(“SIP/213-00000019”, “0?Set(THISPART2=DAHDI/213)”) in new stack
– Executing [[email protected]:7] Set(“SIP/213-00000019”, “NEWDIAL=SIP/213&”) in new stack
– Executing [[email protected]:8] Set(“SIP/213-00000019”, “ITER2=2”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/213-00000019”, “0?begin2”) in new stack
– Executing [[email protected]:10] Set(“SIP/213-00000019”, “THISDIAL=SIP/213”) in new stack
– Executing [[email protected]:11] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:9] Set(“SIP/213-00000019”, “DSTRING=SIP/213&”) in new stack
– Executing [[email protected]:10] Set(“SIP/213-00000019”, “ITER=2”) in new stack
– Executing [[email protected]:11] GotoIf(“SIP/213-00000019”, “0?begin”) in new stack
– Executing [[email protected]:12] Set(“SIP/213-00000019”, “DSTRING=SIP/213”) in new stack
– Executing [[email protected]:13] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:27] GotoIf(“SIP/213-00000019”, “0?nodial”) in new stack
– Executing [[email protected]:28] GotoIf(“SIP/213-00000019”, “0?skiptrace”) in new stack
– Executing [[email protected]:29] GosubIf(“SIP/213-00000019”, “1?ctset,1():ctclear,1()”) in new stack
– Executing [[email protected]:1] Set(“SIP/213-00000019”, “DB(CALLTRACE/213)=213”) in new stack
– Executing [[email protected]:2] Return(“SIP/213-00000019”, “”) in new stack
– Executing [[email protected]:30] Set(“SIP/213-00000019”, “D_OPTIONS=tr”) in new stack
– Executing [[email protected]:31] ExecIf(“SIP/213-00000019”, “0?SIPAddHeader(Alert-Info: )”) in new stack
– Executing [[email protected]:32] ExecIf(“SIP/213-00000019”, “0?SIPAddHeader()”) in new stack
– Executing [[email protected]:33] ExecIf(“SIP/213-00000019”, “0?Set(CHANNEL(musicclass)=)”) in new stack
– Executing [[email protected]:34] GosubIf(“SIP/213-00000019”, “0?qwait,1()”) in new stack
– Executing [[email protected]:35] Set(“SIP/213-00000019”, “__CWIGNORE=”) in new stack
– Executing [[email protected]:36] Set(“SIP/213-00000019”, “__KEEPCID=TRUE”) in new stack
– Executing [[email protected]:37] GotoIf(“SIP/213-00000019”, “0?usegoto,1”) in new stack
– Executing [[email protected]:38] GotoIf(“SIP/213-00000019”, “0?godial”) in new stack
– Executing [[email protected]:39] Set(“SIP/213-00000019”, “CONNECTEDLINE(name,i)=213”) in new stack
– Executing [[email protected]:40] Set(“SIP/213-00000019”, “CONNECTEDLINE(num)=213”) in new stack
– Executing [[email protected]:41] Set(“SIP/213-00000019”, “D_OPTIONS=trI”) in new stack
– Executing [[email protected]:42] Dial(“SIP/213-00000019”, “SIP/213,trI”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/213
– Connected line update to SIP/213-00000019 prevented.
– SIP/213-0000001a is ringing
== Spawn extension (macro-dial-one, s, 42) exited non-zero on ‘SIP/213-00000019’ in macro ‘dial-one’
== Spawn extension (macro-exten-vm, s, 14) exited non-zero on ‘SIP/213-00000019’ in macro ‘exten-vm’
== Spawn extension (from-trunk, 213, 2) exited non-zero on ‘SIP/213-00000019’
– Executing [[email protected]:1] Macro(“SIP/213-00000019”, “hangupcall,”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/213-00000019”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [[email protected]:3] ExecIf(“SIP/213-00000019”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [[email protected]:4] Hangup(“SIP/213-00000019”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/213-00000019’ in macro ‘hangupcall’
== Spawn extension (from-trunk, h, 1) exited non-zero on ‘SIP/213-00000019’

this very first line:

-- Executing [[email protected]:1] Set("SIP/213-00000019", "__RINGTIMER=15") in new stack

would imply that someone who’s context is ‘from-trunk’ dialed 213 and that is what that trace is showing.

Such a trace would happen if you had a trunk configured to be going to from-trunk and it was configured with 3 digit DIDs thus the 213.

So … I wold say something confusing is going on there, because Asterisk is being sent 213 targeted at from-trunk but it appears to be coming from extension 213 as well?

Try turning on SIP tracing in the CLI and redo this so the SIP packets can conclusively show what they are sending and from what device so this can be better analyzed.

Under normal circumstances, what that first line should look like is:

    -- Executing [[email protected]:1] Macro("SIP/213-00000019", "user-callerid,LIMIT,") in new stack

Which means that Asterisk received a call directed at 9052286888 sent into the from-internal context from channel SIP/213 and the first instruction there is the call to macro-user-callerid.

This also would imply that the extension is mis-configured with the wrong context.

Thanks Philippe, what context should the trunk point to, I just assumed that when I created the extension, trunk and routs, FreePBX use the default context.
I guess that’s not the case.
What can I try?
I tried the from-internal(Extensions default) and from-trunk and non worked.

this is what I have on the trunk setting:
host=Bandwidth IP Address
type=peer
dtmf=rfc2833
context=from-trunk

Wilson

Is it possible that you have confused your FXO ports (which use FXS signaling) with your FXS ports (that use FXO signaling) and your from-zaptel FXO’s hardware context are confused with your from-internal FXS’s hardware context by the same logical fallacy?

An easy way to test is to use the obverse in your dahdi config files and make sure you understand that by the rules of file inclusion “the last man standing wins”

It’s not a trunk configuration issue it’s an extension configuration issue.

Yet his zap2dahdi context apparently returns SIP/213 , the reference to DAHDI/213 will probably not get him too far in his attempt to get to a PSTN destination past One Wilshire, (but you are the boss so I will defer to you) . . .

Sorry Guys, I had setup a temp network for this purpose and forgot to change the external IP and local network settings in the sip setting section.
My mistake, here are the logs with the new settings.

[2012-10-04 06:17:57] NOTICE[3363]: chan_sip.c:22871 handle_request_invite: Call from ‘213’ (10.19.200.110:5060) to extension ‘19052286888’ rejected because extension not found in context ‘fron-trunk’.

SIP Debugging enabled

<— SIP read from UDP:10.19.200.110:5060 —>
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-1a1f83f5
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 101 INVITE
Max-Forwards: 70
Contact: “213” sip:[email protected]:5060
Expires: 240
User-Agent: Linksys/SPA921-5.1.8
Content-Length: 399
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: replaces
ontent-Type: application/sdp

v=0
o=- 6421625 6421625 IN IP4 10.19.200.110
s=-
c=IN IP4 10.19.200.110
t=0 0
m=audio 16402 RTP/AVP 8 0 2 4 18 96 97 98 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
<------------->
— (14 headers 18 lines) —
Sending to 10.19.200.110:5060 (NAT)
Using INVITE request as basis request - [email protected]
Found peer ‘213’ for ‘213’ from 10.19.200.110:5060

<— Reliably Transmitting (NAT) to 10.19.200.110:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-1a1f83f5;received=10.19.200.110;rport=5060
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected];tag=as3696a9d9
Call-ID: [email protected]
CSeq: 101 INVITE
Server: FPBX-2.10.1(1.8.16.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="39332fb7"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘[email protected]’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:10.19.200.110:5060 —>
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-1a1f83f5
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected];tag=as3696a9d9
Call-ID: [email protected]
CSeq: 101 ACK
Max-Forwards: 70
Contact: “213” sip:[email protected]:5060
User-Agent: Linksys/SPA921-5.1.8
Content-Length: 0

<------------->
— (10 headers 0 lines) —

<— SIP read from UDP:10.19.200.110:5060 —>
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-6e0e2905
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 102 INVITE
Max-Forwards: 70
Authorization: Digest username=“213”,realm=“asterisk”,nonce=“39332fb7”,uri="sip:[email protected]",algorithm=MD5,response="ed3723ed53743692e7504a8671eaca44"
Contact: “213” sip:[email protected]:5060
Expires: 240
User-Agent: Linksys/SPA921-5.1.8
Content-Length: 399
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: replaces
Content-Type: application/sdp

v=0
o=- 6421625 6421625 IN IP4 10.19.200.110
s=-
c=IN IP4 10.19.200.110
t=0 0
m=audio 16402 RTP/AVP 8 0 2 4 18 96 97 98 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
<------------->
— (15 headers 18 lines) —
Sending to 10.19.200.110:5060 (NAT)
Using INVITE request as basis request - [email protected]
Found peer ‘213’ for ‘213’ from 10.19.200.110:5060
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 2
Found RTP audio format 4
Found RTP audio format 18
Found RTP audio format 96
Found RTP audio format 97
Found RTP audio format 98
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format G726-32 for ID 2
Found audio description format G723 for ID 4
Found audio description format G729a for ID 18
Found unknown media description format G726-40 for ID 96
Found unknown media description format G726-24 for ID 97
Found unknown media description format G726-16 for ID 98
Found audio description format telephone-event for ID 101
Capabilities: us - 0x4 (ulaw), peer - audio=0x90d (g723|ulaw|alaw|g726|g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 10.19.200.110:16402
Looking for 19052286888 in fron-trunk (domain 10.19.200.3)

<— Reliably Transmitting (NAT) to 10.19.200.110:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-6e0e2905;received=10.19.200.110;rport=5060
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected];tag=as3696a9d9
Call-ID: [email protected]
CSeq: 102 INVITE
Server: FPBX-2.10.1(1.8.16.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------>
[2012-10-04 06:18:48] NOTICE[3363]: chan_sip.c:22871 handle_request_invite: Call from ‘213’ (10.19.200.110:5060) to extension ‘19052286888’ rejected because extension not found in context ‘fron-trunk’.
Scheduling destruction of SIP dialog ‘[email protected]’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:10.19.200.110:5060 —>
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.19.200.110:5060;branch=z9hG4bK-6e0e2905
From: “213” sip:[email protected];tag=e891e11f1ede2865o0
To: sip:[email protected];tag=as3696a9d9
Call-ID: [email protected]
CSeq: 102 ACK
Max-Forwards: 70
Authorization: Digest username=“213”,realm=“asterisk”,nonce=“39332fb7”,uri="sip:[email protected]",algorithm=MD5,response="ed3723ed53743692e7504a8671eaca44"
Contact: “213” sip:[email protected]:5060
User-Agent: Linksys/SPA921-5.1.8
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Reliably Transmitting (NAT) to 10.19.200.110:5060:
OPTIONS sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 10.19.200.3:5060;branch=z9hG4bK422bf710;rport
Max-Forwards: 70
From: “Unknown” sip:[email protected];tag=as2d9cc479
To: sip:[email protected]:5060
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.10.1(1.8.16.0)
Date: Thu, 04 Oct 2012 10:18:50 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:10.19.200.110:5060 —>
SIP/2.0 200 OK
To: sip:[email protected]:5060;tag=5657417b2e20e9f5i0
From: “Unknown” sip:[email protected];tag=as2d9cc479
Call-ID: [email protected]:5060
CSeq: 102 OPTIONS
Via: SIP/2.0/UDP 10.19.200.3:5060;branch=z9hG4bK422bf710
Server: Linksys/SPA921-5.1.8
Content-Length: 0
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: replaces

from the CLI type:

sip show peer 213

look for the line about 5 rows down that should look something like:

  Context      : from-internal

I’m thinking yours says ‘from-trunk’ instead of ‘from-internal’ because you can see when you dial that number it is looking for it in ‘from-trunk’ which is wrong. If your extension setup has ‘from-internal’ in the GUI then there is something corrupted or something in one of your sip*.conf files that is breaking you and making Asterisk think your extension is part of ‘from-trunk’.

you’re right, the extension context was from-trunk, (I changed that after the initial setup from “from-internal”).
here is what happens with the from-internal context on the extension.

I get “your call can not be completed as dialed” message.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] ResetCDR(“SIP/213-00000035”, “”) in new stack
– Executing [[email protected]:2] NoCDR(“SIP/213-00000035”, “”) in new stack
– Executing [[email protected]:3] Progress(“SIP/213-00000035”, “”) in new stack
– Executing [[email protected]:4] Wait(“SIP/213-00000035”, “1”) in new stack
– Executing [[email protected]:5] Progress(“SIP/213-00000035”, “”) in new stack
– Executing [[email protected]:6] Playback(“SIP/213-00000035”, “silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer”) in new stack
– <SIP/213-00000035> Playing ‘silence/1.ulaw’ (language ‘en’)
– <SIP/213-00000035> Playing ‘cannot-complete-as-dialed.ulaw’ (language ‘en’)
== Spawn extension (from-internal, 9052286888, 6) exited non-zero on ‘SIP/213-00000035’
– Executing [[email protected]:1] Hangup(“SIP/213-00000035”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/213-00000035’

you don’t have a proper route setup for it in your outbound routes

I just used the default setting of FreePBX on the route.
Route Name = local
dial patterns = NXXNXXXXXX
trunk = bandwidth

I Also tried dial pattern = X.
I will try to remove the rout and start over
Any other ideas.

Thanks.

I guess Bandwidth require all outgoing calls to be in a.164 format but the cant tell you how to set it up in freePBX even though they claim their trunks are FreePBX ready. I search on the net for FreePBX a.164 format and the only one I found was Philippe’s post + and 1=NXXNXXXXXX but non of it worked for me

the fix is, you have to add 1 to the “prepend” field of the 10 digit dialing. and 1716 (1+area code) to the 7 digit dialing, it looks something like this:
(1 ) + prefix NXXNXXXXXX
(1716 ) + prefix NXXXXXX

that’s it, I hope this will help other Bandwidth customers.
Thanks All for all your help.

Wilson.

Wilson,

I’m glad you got it setup and posted information that will help others.

As far as the error above though, the error I commented on above looked like it was because there was no route in FreePBX setup to send it to the Bandwidth trunk in the first place, unless you did not post the entire CLI trace.

In other words, it never got around to detecting the ‘next’ error which was the need send the call out the Bandwidth trunk in e164 format, which, btw, the best place to do that is in the trunk manipulation rules since if you happened to have a route with multiple trunks as failover options, other carriers might need a different format and this would allow you to adapt to each carrier’s requirements when sending out an attempted call even if they are all part of the same route.