I’ve Asterisk@home 2.7, and I would like to trunk my PBX with a voip provider server (skypho).
The my sip.conf file is the follow:
[code][general]
port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
allow=gsm
context = from-pstn ; Send unknown SIP callers to this context
callerid = Unknown
register=0442xxxxx:password:0442xxxxx@voip.eutelia.it/0442xxxxx
[0442xxxxx]
username=0442xxxxx
type=user
srvlookup=yes
secret=password
realm=voip.eutelia.it
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it
context=from-skypho
[0442xxxxx-out]
username=0442xxxxx
type=peer
secret=password
qualify=yes
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it[/code]
I can receive and make calls. The my problem is that all the calls I receive are managed with [from-pstn] context. The row of the trunk:
is not considered.
Any suggestions?
I am spawning my SIPs in a context included by default, so cant say for sure or if this is bugged (your * version?)
Oh…no, forget my previous posting, its correct : The context based “context line” overrides the general section, correct !
Shame on me !
Your fault is here:
[0442xxxxx]
username=0442xxxxx
type=user
srvlookup=yes
secret=password
realm=voip.eutelia.it
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it
context=from-skypho
[0442xxxxx-out]
username=0442xxxxx
type=peer
secret=password
qualify=yes
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it
You are defining the same user (not context label, USER !) two times, so the last context is taken - and there is no context specified, so the GENERAL context definition takes place !
You cant (logically) have a SIP registering “twice”:
You need to define it ONCE, spawn it in the appropiate context and have the dialout string handled by diff. contexts via context-includes.
Ok, it’s right.
Now, next step: I want add a second trunk with a different DID number. The my sip.conf now is:
[code][general]
port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
allow=gsm
context = from-pstn ; Send unknown SIP callers to this context
callerid = Unknown
register=0442xxxxx:password:0442xxxxx@voip.eutelia.it/0442xxxxx
register=0442yyyyy:password2:0442yyyyy@voip.eutelia.it/0442yyyyy
[0442xxxxx]
username=0442xxxxx
type=user
srvlookup=yes
secret=password
realm=voip.eutelia.it
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it
context=from-skypho
[0442xxxxx-out]
username=0442xxxxx
type=peer
secret=password
qualify=yes
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442xxxxx
fromdomain=voip.eutelia.it
context=from-skypho
[0442yyyyy]
username=0442yyyyy
type=user
srvlookup=yes
secret=password2
realm=voip.eutelia.it
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442yyyyy
fromdomain=voip.eutelia.it
context=from-skypho2
[0442yyyyy-out]
username=0442yyyyy
type=peer
secret=password2
qualify=yes
nat=yes
insecure=very
host=voip.eutelia.it
fromuser=0442yyyyy
fromdomain=voip.eutelia.it
context=from-skypho2[/code]
The my problem is now that if I call 0442xxxxx or 0442yyyyy, Asterisk use always the context from-skypho2 (the last I specify). In that way I cant hadle in different ways the call to the two different numbers.
You need to reread the concept of asterisk, i think you miss some basic conceptional informations.
The SIP.conf is only for registering.
What you want to do is handled by the dialplan.
In fact the contex I specify are in the dialplan (extensions.conf).
This structure of sip.conf is automatically generated from the asterisk GUI AMP. So I dont think is so wrong.
Check with your SIP provider and debug the incoming SIP call. It may be that while the second number is linked to your account, your VSP is actually delivering calls all to the first number, so Asterisk only sees that number.
I dont know how but now all works. I remake the configuration in the same way and now is ok.