Upgrade 3CX to v18 and get it hosted free!

Asterisk settings for Sipgate

Author image
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:[email protected]/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.,1,Set(__MSN=49308151234560)
 same => n,Goto(trunk-sipgate,${EXTEN},1)

; Private extensions using this context to dial out with 4930815123456-1
[trunk-private]
exten => _X.,1,Set(__MSN=49308151234561)
 same => n,Goto(trunk-sipgate,${EXTEN},1)

...

 

 


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.