Inbound call not being directed to proper context

Seems to be being directed to “from-sip-external” context
instead of “from-trunk”

-- Executing [[email protected]:1] NoOp("SIP/211.168.1.101-b7724708", "Received incoming SIP connection from unknown peer to 6013094718") in new stack
-- Executing [[email protected]:2] Set("SIP/211.168.1.101-b7724708", "DID=6013094718") in new stack
-- Executing [[email protected]:3] Goto("SIP/211.168.1.101-b7724708", "s|1") in new stack
-- Goto (from-sip-external,s,1)
-- Executing [[email protected]:1] GotoIf("SIP/211.168.1.101-b7724708", "0?from-trunk|6013094718|1") in new stack
-- Executing [[email protected]:2] Set("SIP/211.168.1.101-b7724708", "TIMEOUT(absolute)=15") in new stack
-- Channel will hangup at 2008-08-04 18:16:53 UTC.
-- Executing [[email protected]:3] Answer("SIP/211.168.1.101-b7724708", "") in new stack
-- Executing [[email protected]:4] Wait("SIP/211.168.1.101-b7724708", "2") in new stack
-- Executing [[email protected]:5] Playback("SIP/211.168.1.101-b7724708", "ss-noservice") in new stack
-- <SIP/211.168.1.101-b7724708> Playing 'ss-noservice' (language 'en')
-- Executing [[email protected]:6] PlayTones("SIP/211.168.1.101-b7724708", "congestion") in new stack
-- Executing [[email protected]:7] Congestion("SIP/211.168.1.101-b7724708", "5") in new stack

I see various references on the Web about putting "context = from-trunk"
in sip.conf. I have done so:

;========================================================
; If you need to answer unauthenticated calls, you should change this
; next line to ‘from-trunk’, rather than ‘from-sip-external’.
; You’ll know this is happening if when you call in you get a message
; saying “The number you have dialed is not in service. Please check the
; number and try again.”
;context = from-sip-external ; Send unknown SIP callers to this context

; OK, let’s change it. 2008 Aug 3:
context = from-trunk
;========================================================

Still doesn’t seem to go to the right place.

Does anyone have some hints on how I might get this
to work?

If you edit the sip.conf file it will get replaced. FreePBX owns all files that do not end in _custom.conf and as such can and will overwrite them when it see’s fit to do so (some every time a change is saved, other times when upgrading a mudule, etc). The context from-sip-external is set from the sip_general_additional.conf file which is also re-generated automaticly… The proper place to change the context for a incoming sip trunk is inside the sip trunk settings when you created the trunk.

Did you check the box to allow for anonymous sip connections in the general setting (under security setting)? If not it will not allow then to start.

If you edit the sip.conf file it will get replaced.
FreePBX owns all files that do not end
in _custom.conf and as such can and will
overwrite them when it see’s fit to do so
(some every time a change is saved, other
times when upgrading a mudule, etc).

OK. But if I edit them in the Web interface, they
change and are protected from being overwritten,
yes?

The context from-sip-external is set from the
sip_general_additional.conf file which is
also re-generated automatically.

This what I have for sip_general_additional.conf. How
do I get it so that inbound calls go to the proper context?

;====================================================
; do not edit this file, this is an auto-generated file by freepbx
; all modifications must be done from the web gui

vmexten=*97
bindport=5060
bindaddr=0.0.0.0
disallow=all
allow=ulaw
allow=alaw
context=from-sip-external
callerid=Unknown
notifyringing=yes
notifyhold=yes
limitonpeers=yes
tos_sip=cs3
tos_audio=ef
tos_video=af41
;====================================================

The proper place to change the context for a incoming
sip trunk is inside the sip trunk settings when you
created the trunk.

And that would be within “extensions.conf”, yes?

Did you check the box to allow for anonymous sip connections
in the general setting (under security setting)? If not it will
not allow then to start.

That could be my problem. However, I was under the impression
that allowing anonymous SIP connections is a security risk. Isn’t
that the case?

No do not edit those files or you will loose your changes. FreePBX owns those files (Sip, extension, etc). The only files that FreePBX will not overwrite are files that end in _custom.conf (also sip_nat.conf). So when you “look” at sip.conf you will see a series of include lines. Some end in _custom.conf. Those are files that you can edit and/or create if they don’t exist and place things in them that will NOT get overwritten.

The issue seems to be that your sip trunk has the wrong context so that should be addressed in the screen where you created the trunk. Place the line context=from_trunk in there.

No do not edit those files or you will lose your changes.
FreePBX owns those files (Sip, extension, etc). The only files
that FreePBX will not overwrite are files that end in
_custom.conf (also sip_nat.conf). So when you “look” at
sip.conf you will see a series of include lines. Some
end in _custom.conf. Those are files that you can edit
and/or create if they don’t exist and place things in them
that will NOT get overwritten.

So not “_custom.conf” files can’t be edited the the Web
interface in any way? What about through MySQL?

The issue seems to be that your sip trunk has the wrong
context

Or, that and inbound call is not being directed to the proper
context.

so that should be addressed in the screen where you created
the trunk.

Right.

Place the line context=from_trunk in there.

Well, I have “context=from-trunk”. I think it is supposed to
be a dash rather than an underscore, correct?

If so, it still doesn’t work.

As strange as it may seem the solution to this problem was the
following:

PBX -> PBX Settings -> Inbound Routes > Click on the Route In Question ->

Under “Edit Incoming Route” there are 3 fields:

Description: Main-Inbound-Number
DID Number: 6013094718
Caller ID Number: DO NOT PUT THE PHONE NUMBER HERE!!!

As bizarre as this might sound, do NOT put the phone number
in the “Caller ID Number” field!

By deleting this entry, the inbound calls were directed to the
proper context and the IVR.

This should be documented better since it is unclear that this
will foul things up if you put the DID number here.

I have tried everything and still get the same message - “The number you ahve reached is not in service”. Is there something else I can try? Please help.

Please show us some output.

seedtech your problem is not this problem. Please see your first post and provide some of the information requested.

I added context=from-trunk to the PEERS details field in the trunk definition. This seemed to make it work form me. I do not know why but it did.

Your provider is treating you as an extension rather than a peer (VERY common for commercial VoIP providers). In that case the entire user configuration section of the trunk settings is simply ignored, but you must still have a context=from-trunk statement and in that case it has to go in the peer details, just as you discovered.

Just removed number from the CallerID Number field and it started working. Yea!!!