Inbound Routes


I have an problem. I’m tring to make it possible for my users to be called from outsite to asterisk server, that for I have 1 inbount nummber from my VoIP provider.

Those are my configurations, throuw FreePBX

Extension -> sip device, I have for now just 1 device configurated
Extension: 1020
context = from-trunk
secret = *****
dtmfmode = rfc2833
context = from-internal
host = dynamic
type = friend
nat = yes
port =5060
dial = SIP/1020

Softphone registration without problem. OK

Trunk configuration is:
Trunk SIP/voicetradin
General Settings:
Outbound Caller ID = 037412121212
Outgoing Dial Rules = .
Outgoing Settings:
Trunk name = voicetrading
peer details:
Incoming Settings:
–all empty–

Outbound routes
Dial Pattern = .
Trunk Sequence = Sip/voicetrading

Inbound Routes:
Description = incomming
DID and CID = Empty to match all
Set Destination:
Extensions: 1020

Whan calling out throuw asterisk, it’s OK, totaly no problem it takes the voicetrading context and calls out.
But whan calling to my Registered number 31557110349 It must go to my SIP device 1020, I see in Asterisk CLI that the Asterisk recognized the call but somehow I get ss-noservice.

This is the log:
– Executing [[email protected]:1] NoOp(“SIP/”, “Received incoming SIP connection from unknown peer to 31557110349”) in new stack
– Executing [[email protected]:2] Set(“SIP/”, “DID=31557110349”) in new stack
– Executing [[email protected]:3] Goto(“SIP/”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]:1] GotoIf(“SIP/”, “0?from-trunk|31557110349|1”) in new stack
– Executing [[email protected]:2] Set(“SIP/”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2007-12-18 08:59:03 UTC.
– Executing [[email protected]:3] Answer(“SIP/”, “”) in new stack
– Executing [[email protected]:4] Wait(“SIP/”, “2”) in new stack
– Executing [[email protected]:5] Playback(“SIP/”, “ss-noservice”) in new stack
– <SIP/> Playing ‘ss-noservice’ (language ‘en’)
== Spawn extension (from-sip-external, s, 5) exited non-zero on ‘SIP/’
– Executing [[email protected]:1] NoOp(“SIP/”, “Hangup”) in new stack
– Executing [[email protected]:2] Set(“SIP/”, “DID=s”) in new stack
– Executing [[email protected]:3] Goto(“SIP/”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]:1] GotoIf(“SIP/”, “0?from-trunk|s|1”) in new stack
– Executing [[email protected]:2] Set(“SIP/”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2007-12-18 08:59:09 UTC.
– Executing [[email protected]:3] Answer(“SIP/”, “”) in new stack
== Spawn extension (from-sip-external, s, 3) exited non-zero on ‘SIP/’

I tried the same with coding it in asterisk extensions.conf unther [from-sip-external] and it works OK
exten => _XXXXXXXXXXX,1,Dial(SIP/1020)

;give external sip users congestion and hangup
; Yes. This is really meant to be _. - I know asterisk whinges about it, but
; I do know what I’m doing. This is correct.
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"=“yes”]?from-trunk,${DID},1)
exten => s,n,Set(TIMEOUT(absolute)=15)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)
exten => h,1,NoOp(Hangup)
exten => i,1,NoOp(Invalid)
exten => t,1,NoOp(Timeout)

But somehow I cant configure it throuw FreePBX for my incomming call, who can see what am I doing wrong>?

Thanks for advance.

you didn’t put the DID in the inbound route?

to add, but results are the same.
I did in DID the following: 31557110349 after I tried with 0031557110349 and again with 0557110349 but again with the same problem.

Any ideas?

of the trunk. it looks from the logs like there is no context defined. it should be ‘from-trunk’ maybe?

You definitely need to have a context= statement of some kind in your trunk definition, otherwise the call has no place to go. Try context=from-trunk and also make sure that your inbound route is correctly defined.

But ware do I define that context? In place of this “context = from-internal”, this I got in FreePBX extensions configuration automaticly wane I create an new extension.
and other , I don’t see ware I can place that…

I thought I clearly said, in your TRUNK definition. Whatever gave you the idea that had anything to do with the extension configuration? Quoting your post:

peer details:

Put it anywhere in that section!

Allready have that one in there, somehow it won’t paste in my erly post,
this is what I have in my Outgoing Settings:
But this is for my Outgoing call’s, hase nothing to do with my incomming calls, do I think…

Other comments?

Are FreePBX developers in here who can help me with this? I don’t think it must be so hard, but ther is something that I don’t see

the trunk screen has TWO sections, one for inbound and one for outbound. the fact that you don’t get this is not a reason to insult people who are trying to help you. clue: asking for developers to help you implies you think we are clueless. we’re not…

Yes there are, as well as a lot of very very helpful and experienced users. And we do scan the forums and help a lot of people, depending on our cycles and other things going on. If you want the exclusive time of a developer to help you on something, there is one sure way to get that which is to pay for support credit and then one of us will get back to you.

They are really only an outbound service from what I know, similar to VoipJet and others. Is that number you listed something they gave you? Maybe you need to enable anonymous sip calls for inbound?

This is not something that I don’t get or you don’t get or who is clueless… You think I’m clueless? I don’t think so.
But sometime’s the things are clueless, and the fact that I asked for a developer is not a thing that I don’t get that you want to help me…, but in this case that I asked for a developer is to breanstorm with them to find out more, and be helpfull for other people who hase the same problem as I do, and I’m not tring to insult people, simply I asked for more comments that’s all…

If I insult you, so my bad… I’m sorry, it was not my meening to do that.

I am in not an * expert! I had the same problem with stanaphone and any other inbound sip call. The following is how I got it working. I am supprised you have to do it this way because it seems that you should not have to open the flood gates if you have a trunk setup for this sip provider. If there is another way please let me know!!!

Go to the General Settings section
Go down to "Allow Anonymous Inbound SIP Calls"
Set it to Yes
Submit and Apply changes

…also read this thread:

Hey all!
I have the same problem as, people worte above. The story in nutshell: I have to connect PSTN to asterisk. Theres a Cisco router at my university that does this, so i didnt need to buy an FXO card. So, i got a phone number, and if this numbers called, the cisco router forwards the call to my asterisk. But here comes the trouble, this call is from an “unknown user”, and the asterisk dumps these calls:( In sip.conf theres a line “context=from-sip-external” so i need to change this, in order to not to dump the calls. I changed it to “from-trunk” (as it was mentioned in the comments), but its just the same. So i wrote a custom context, and theres only two lines, like this:
exten => 84,1,Answer
exten => 84,2,Hangup
84 is the number, you should dial after the phone number (my extension). So i have a registered user “84”, to recieve these calls. And the funny part is, the call comes in (you can see in CLI, and the X-Lite’s ringig as well), but when im trying to answer it, it goes immediately busy! :s
Im, not an expert in this as far, so could anybody write me some “idiot-proof” lines, what should i change, where, and how??:))
Thanks guys!


I am dealing with the same problem, I guess.
Somewhere in you PEER Details (in the trunk, on FreePBX), there is a hostname. When you add
right after the hostname line, then you might get inbound calls. But: it will result in the impossibility to make outbound calls: “All circuits are busy now, please try again later”.
So you can choose: outbound or inbound :slight_smile: That is al least the choice I am having. Unless somebody here has a solution!

Just for the record:

I was facing the same situation, that calls from my SIP provider did not get into ‘from-trunk’. The solution was to add ‘insecure=port,invite’ to the trunk configuration ( ‘type=fried’ was there also for me )