[Asterisk-Users] confusion about contexts

Alyed Tzompa alyed.tzompa at simitel.com
Tue Jan 3 17:27:59 MST 2006


I'm a bit confused on how you get your calls to Asterisk, what I mean is: are you phoning into asterisk via a sip user? in this 
case, which one?, if not is it iax or though a zap channel?

anyway, here some tips:

For your first problem it seems it has to do with what I pointed above, check that the user which is dialing into asterisk has 
the correct context (context=create-menu) with at least type= peer

also don't have to retype the allow=codec, disallow=codec, dtmfmode=x for every user, just set it in the general context in 
sip.conf

your second problem think it has to do once again with the firts thing above, and regarding the retyping, I'm afaid I don't know 
any other way than writing those lines again and again for everyuser. Maybe someone else out there knows someting else that can help.

Don't set many "outgoing" context for every user in sip.conf!!!!! just set one and point all users to that one. If you need your 
user to have acces to other contexts just add 
include => your_context
at the end of whatever context you want (btw can add more than one inlcude's )

Alyed  
-------------------------------------------
Hi,

Hope someone can help me-Asterisk isn’t behaving as I would expect
and I think it’s down to my contexts.

There are two things I can’t fathom.

Firstly I want to record an IVR and so have created a user 20005 and
a context called createmenu. I am using SER in front of asterisk so I
changed the ser.cfg so that if the user dialled this number it
forwards to asterisk. This works fine. The problem is when the invite
reaches my asterisk box, asterisk uses the wrong context. It appears
to call the “outgoing” context which is the context used to route
calls to my pstn gateway provider. It then trys to execute a “Dial”
command for 20005 which isn’t supposed to happen.

Secondly SER uses Asterisk for voicemail if a phone doesn’t answer
after a certain period of time or is busy. This works fine but I have
to create an entry for every user in extensions.conf under the
[default] context. Can I create a generic entry which would also work
to shorten the config file?...Also if I change this and out all the
entries under a context “voicemail” it doesn’t work
.I have to keep
it in default
This must obviously be something got to do with
Asterisk finding the contexts.

I am confused as to how you apply multiple contexts to one user. At
the moment nearly each user (besides 20005 and 1234) has a context of
‘outgoing’ in sip.conf. This is so that they can make outgoing pstn
calls
But what if I needed them to use another context in other
situations?...I’m just confused as to what context should be applied.

I have included the relevant parts of my sip.conf and extensions.conf
below. I would appreciate any advice as to why these issues are
occurring.

Many thanks,
Aisling.

;sip.conf
[general]

bindport=5064
bindaddr=0.0.0.0
disallow=all
allow=ulaw
allow=alaw
allow=gsm
srvlookup=yes
canreinvite=no;
autocreatepeer=yes
nat=yes
dtmfmode=info
insecure=very
registerattempts=0

register => username:password at sip.blueface.ie/1234

;To receive incoming calls specify this and replace
"yourcontext-pstn" for your dial plan

[blueface-in]
type=peer
host=sip.blueface.ie
context=pstn

[1234]
type=friend
username=1234
canreinvite=no
context=pstn
insecure=very
;callerid= "Ais" <1234>
host=dynamic
nat=yes
dtmfmode=INFO
mailbox=1234
disallow=all
allow=alaw
allow=ulaw
allow=g723.1
allow=g729

;added below line(s) for BLUEFACE conf
;To make outgoing calls specify this block

[blueface-out]
type=peer
host=sip.blueface.ie
username=username
secret=password

[20005]
type=friend
username=20005
canreinvite=no
context=createmenu
insecure=very
;callerid= "Ais" <20005>
host=dynamic
nat=yes
dtmfmode=INFO
mailbox=20005
disallow=all
allow=alaw
allow=ulaw
allow=g723.1
allow=g729

[300]
type=friend
username=300
canreinvite=no
context=outgoing
insecure=very
;callerid= "voicemail user 1" <300>
host=dynamic
nat=yes
dtmfmode=INFO
mailbox=300
disallow=all
allow=alaw
allow=ulaw
allow=g723.1
allow=g729

extensions.conf
[general]
static=yes
writeprotect = yes

[createmenu]
exten => 20005,1,Wait(2)
exten => 20005,2,Record(/tmp/asterisk-recording:gsm)
exten => 20005,3,Wait(2)
exten => 20005,4,Playback(/tmp/asterisk-recording)
exten => 20005,5,wait92)
exten => 20005,6,Hangup

;specify context for receiving incoming calls
[pstn]
;Note this is just an example there are infinite different ways to
handle the incoming call.
;exten => 1234, 1,Wait(1)
;exten => 1234, 2,Playback(beep)
;exten => 1234, 3,Hangup
exten => 1234, 1, Dial

(SIP/2092 at seraddress) ; 1234 is the contact extension, default
contact extension is "s"

;exten => 2092,1,Answer()
;exten => 2092,2,Playback(welcome)
;exten => 2092,3,Background(menu)
;exten => 1,1,Dial($316)
;exten => 2,1,Dial($314)

[outgoing]
; Dial the Blue Face Speaking Clock
exten => 300,1,Dial(SIP/300 at blueface-out)
exten => 300,2,Hangup

;Send PSTN calls to Blue Face
exten => _X.,1,Dial(SIP/${EXTEN}@blueface-out)
exten => _X.,2,Hangup

[default]

exten => 300, 1,Dial(SIP/300,20)
exten => 300, 2,Voicemail(u300)
exten => 300, 102,Voicemail(b300)
exten => 300, 103,Hangup

exten => 301, 1,Dial(SIP/301,20)
exten => 301, 2,Voicemail(u301)
exten => 301, 102,Voicemail(b301)
exten => 301, 103,Hangup 

etc etc

-------------------Legal Disclaimer---------------------------------------

The above electronic mail transmission is confidential and intended only for the person to whom it is addressed. Its contents may be protected by legal and/or professional privilege. Should it be received by you in error please contact the sender at the above quoted email address. Any unauthorised form of reproduction of this message is strictly prohibited. The Institute does not guarantee the security of any information electronically transmitted and is not liable if the information contained in this communication is not a proper and complete record of the message as transmitted by the sender nor for any delay in its receipt.

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060103/9cbc56b4/attachment.htm


More information about the asterisk-users mailing list