PEER context ignored with DID?

Having this issue on Callcentric and have read quite a bit and have learned a lot. I’m having some trouble understanding some behavior that’s keeping things from working. DID number in the logs changed to 19993334444 to protect the innocent. After reading a lot of guides (Callcentric’s, FreePBX “How to get the DID…”, and others) I found the “from-pstn-toheader” context which looked like it did what I wanted.

If I have:
trunk (callcentric) configured with “context=from-pstn-toheader” in the PEER Details
route configured as “any DID / any CID”

I get the following in my logs:

Executing [[email protected]:1] Goto(“SIP/callcentric-00000010”, “from-pstn,19993334444,1”) in new stack
Goto (from-pstn,19993334444,1)
Executing [[email protected]:1] NoOp(“SIP/callcentric-00000010”, “Catch-All DID Match - Found 19993334444 - You probably want a DID for this.”) in new stack
Executing [[email protected]:2] Set(“SIP/callcentric-00000010”, “__FROM_DID=19993334444”) in new stack
Executing [[email protected]:3] Goto(“SIP/callcentric-00000010”, “ext-did,s,1”) in new stack
Goto (ext-did,s,1)
Executing [[email protected]:1] ExecIf(“SIP/callcentric-00000010”, “0?Set(__FROM_DID=s)”) in new stack

I agree! I do want a DID for this! So if I change my “any DID / any CID” route to have my incoming “DID Number” I get the following when I call:
Executing [[email protected]:1] NoOp(“SIP/66.193.176.35-00000012”, “No DID or CID Match”) in new stack
Executing [[email protected]:2] Answer(“SIP/66.193.176.35-00000012”, “”) in new stack
Executing [[email protected]:3] Wait(“SIP/66.193.176.35-00000012”, “2”) in new stack
Executing [[email protected]:4] Playback(“SIP/66.193.176.35-00000012”, “ss-noservice”) in new stack

Annnd that confuses me. No longer is the initial context the “from-pstn-toheader” but it goes right to “from-pstn” which obviously has no proper DID argument at this point.
With the “any DID / any CID” case you can see that “context=from-pstn-toheader” is being honored and the DID is being extracted properly. In fact, I can succesfully go to any custom context. As soon as I remove the catch all “any DID / any CID” the context in my PEER details appears to be ignored and from-pstn is always used.
Can anyone help? It should be “easy”. :slight_smile:

This looks like a bug in FreePBX and/or Asterisk. Bold statement from someone new to this but…

A context= entry in “PEER Details” is ignored.

Going into “Asterisk SIP Settings” there’s a settings for “Default Context”. The pop up help says, “Asterisk: context. Default context for incoming calls if not specified. FreePBX sets this to from-sip-external which is used in conjunction with the Allow Anonymous SIP calls. If you change this you will effect that behavior. It is recommended to leave this blank.”

But this is the only way I’ve been able to set the context for a trunk. If left blank “from-sip-external” is invoked. If filled in, whichever context is provided is used. Filled in or blank, whatever is put in the PEER Details is unused. Unfortunately that means there’s only one context shared by all trunks?

Am I missing obvious or is this a bug?

It’s not ignored, your trunk is wrong and not recognizing the call as from Callcentric thus not using the peer entries.