Quantcast
Channel: VOIP-info.org Wiki Changes
Viewing all articles
Browse latest Browse all 5767

Asterisk settings for Sipgate

$
0
0

Asterisk Configuration Examples


Incoming and Outgoing Settings



here's a hint on how to place and receive calls through sipgate.de network.


Sample in sip.conf


[general]
...

register => sipuid:PASSWD@sipgate.de/sipuid

[sipgate.de]
type=peer
defaultuser=sipuid
fromuser=sipuid
secret=PASSWD
context=incoming
extension=sipuid
host=sipgate.de
dtmfmode=rfc2833
qualify=yes
fromdomain=sipgate.de
nat=no
directmedia=no
canreinvite=no
insecure=port,invite
allow=!all,alaw,g722

;; local extensions examples
[chef]
type=friend
...
context=trunk-office

[lisa]
type=friend
...
context=trunk-private

[john]
type=friend
...
context=trunk-private

; Faximile client always sets sipgate MSN directly via sip.conf
[faximile]
type=friend
...
context=trunk-sipgate
setvar=__MSN=49308151234569



The sipuid typically looks like 1234567e0. Replace all "sipuid" with your real sipuid.
The telephone number format sipgate uses is 4930123456 (without + or 00)
Possible MSN suffixes are callerid without any or with leading 0, 1, 2 or 9.
If a sipgate2sipgate internal call comes in sipgate sends only the sipuid from the caller and the public phone number seperatly via P-Asserted-Identity. I've implemented a little workaround to avoid the useless sipuid's as caller's telephone number.

This example is only to give an idea for handling calls from and to sipgate.de.
It's not a fully qualifyed configuration "ready to use".

Example below allows to override the outgoing callerid by setting the P-Preferred-Identity-Header before dialout.
At the Sipgate Basic web configuration page you have to set all related MSN to be routed to the one sipuid used in sip.conf and the sipuid must be configured to "client sets MSN".

Remember the strange number format without "+" or "00" before the LD prefix,

By default sipgate offeres one telephone number.
To use multiple MSN or fax you must have a sipgate Pro-Account.










Sample in extensions.conf


...

[incoming]
;; Handling sipgate.de related stuff
exten => sipuid,1,NoOp(Call via sipgate routing to s@incoming now)
; try to extract phone number from sip header P-Asserted-Identity
 same => n,Set(FON=$["${SIP_HEADER(P-Asserted-Identity)}" : "<sip:([0-9]+)"])
 same => n,ExecIf($[${ISNULL(${FON})}=0]?Set(CALLERID(num)=${FON}))
; save the MSN wich was dialed
 same => n,Set(CALLERID(dnid)=$[ "${SIP_HEADER(TO)}" : "<sip:([0-9e]+)" ])
 same => n,Goto(s,1)

;; Handle calls
exten => s,1,Verbose(Route MSNs)
 same => n,GosubIf($["${CALLERID(dnid)}" = "49301234560"]?incoming-office,s,1)
 same => n,GosubIf($["${CALLERID(dnid)}" = "49301234561"]?incoming-private,s,1)
 same => n,GosubIf($["${CALLERID(dnid)}" = "49301234569"]?incoming-fax,s,1)
 same => n,Answer
 same => n,Playback(tt-weasels)
 same => n,Hangup

[incoming-office]
exten => s,1,NoOp(Ring office phones)
 same => n,Dial(SIP/chef)
 same => Hangup

[incoming-private]
exten => s,1,NoOp(Ring private phones)
 same => n,Dial(SIP/lisa&SIP/john)
 same => Hangup

[incoming-fax]
exten => s,1,Dial(SIP/faximile)
 same => Hangup

[trunk-sipgate]
exten => _X.,1,Set(CALLERID(num)=sipuid) ; Outgoing CALLERID(num) has to be your sipuid!
 same => n,Progress

 ; Set default outgoing callerid if env var ${MSN} is not set
 same => n,ExecIf($["${MSN}"=""]?Set(MSN=49308151234562))
 same => n,SipAddHeader(P-Preferred-Identity: <sip:${MSN}@sipconnect.sipgate.de>)

 same => n,Dial(SIP/sipgate.de/${EXTEN},180,trg)
 same => n,Hangup

; Office extensions using this context to dial out with 4930815123456-0
[trunk-office]
; Remember LD prefix without + or 00!
exten => _X. ...

Viewing all articles
Browse latest Browse all 5767

Trending Articles