Asterisk How to connect to Nikotel

From the Asterisk Mailing list:

insecure=very ; required if you want to accept incoming Nikotel calls from host
promiscredir=yes ; required to handle the Nikotel 302 redirect message

Use the above example, the one below didn't work for me, and neither did the FAQ at nikotel.

Approach 2 (alternative)


; registration is only required if you want to be called through Nikotel

; only for incomings call via nikotel
type=user (???)
promiscredir=yes ; required to handle the Nikotel 302 redirect message

; for outgoing calls only
type=peer ; use with "Dial(SIP/${EXTEN}@nikotel-out)"
fromuser=##username## ; IMPORTANT! Nikotel requires this!
allow=gsm ; Nikotel supports g.729 (?), g.711 (ulaw/alaw) and GSM, but not iLBC


include => parkedcalls
include => default

; Dialing a PSTN numuber (creates costs!)
exten => _00X.,1,SetAccount(billing-username)
exten => _00X.,2,Dial(SIP/${EXTEN:2}@nikotel-out,90)
exten => _00X.,3,Hangup
exten => _00X.,103,Congestion
; Dialing a Nikotel VoIP number (no costs)
Nikotel answers with a "temporary moved" msg, but Asterisk (on purpose) doesn't
; automatically follow this redirection method. Instead Asterisk looks in its own
; dialplan to learn how to proceed
exten => _99XXXXXXXXXX,1,Dial(SIP/${EXTEN}@nikotel-out-phil,90)
exten => _99XXXXXXXXXX,2,Hangup
exten => _99XXXXXXXXXX,102,Congestion
; special extension for Joe (99xxxxxxxxxx@nikotel)
exten => 991234,1,Dial(SIP/joesmith@nikotel-out)
exten => 991234,2,Congestion

Approach 3

Nov. 05 with Asterisk v1.2.0

; Nikotel peer to handle an incoming call; not for 302 redirect

; Nikotel IP for host calamar0 as used in 302 "Moved Temporarily" SIP message

for Nikotel user 112233 - for outgoing calls like
type=peer ; we don't have NikoTalk, so we cannot be called
fromuser=NikotelUsername ; IMPORTANT! Nikotel requires this!

If you DON'T want to use promiscredir=yes, THEN you'll need to modify your extensions.conf and enter all extensions that Nikotel will redirect you to. This must then not only include the number-to-username match, but also the (optional) username-to-mailboxnumber match. Note that without promiscredir you have better control over the Nikotel credentials for the outgoing call, i.e. you can chose either @nikotel-out-userA or @nikotel-out-userB etc. Note that Nikotel does not accept unauthenticated SIP calls, however it does have peering agreements with GMX, sipsnip, FWD and a few others.

; == treating re-directed (=initially outgoing) Nikotel VoIP calls
; See the "302 Moved temporarily" msg from Nikotel
exten => nikouser1,1,Dial(SIP/${EXTEN}@nikotel-out-myuser)
exten => nikouser1,2,HangUp
exten => nikouser2,1,Dial(SIP/${EXTEN}@nikotel-out-otheruser)
exten => nikouser2,2,HangUp
; == Nikotel mailbox forwarding ==
Mailbox for user Xyz
exten => _4225XXXXXXXXXX,1,Dial(SIP/${EXTEN}@nikotel-out-myuser)
exten => _4225XXXXXXXXXX,2,HangUp

And finally here's a sample CLI output of such a double 302 redirect where we dial the Nikotel number, get redirected to the username, and then finally to the user's mailbox at Nikotel (pattern 4225XXXXXXXXXX):

— Executing Dial("SIP/myuser-a26c", "SIP/991234567890@nikotel-out-myuser|90") in new stack
— Called 991234567890@nikotel-out-myuser
— Got SIP response 302 "Moved Temporarily" back from
— Now forwarding SIP/myuser-a26c to 'SIP/otheruser@' (thanks to SIP/nikotel-out-myuser-74b8)
— Got SIP response 302 "Moved Temporarily" back from
— Now forwarding SIP/myuser-a26c to 'SIP/42256102123456@' (thanks to SIP/

The official Nikotel * config is located at, however that is faulty (Nov '05):
Direct FAQ link

Update 07/24/2004 :
Still these instructions don't work, since Nikotel uses a SIP 302 Redirect feature, if you call internal 99XXXXXXXXXX numbers. Nikotel will redirect you to your account (your username you had choosen at registration).

Asterisk now can play with SIP 302 redirect, thus works with Nikotel.
Add this to your sip.conf (in Nikotel peer section for outbound calls)


Use CVS Head 07/18/2004 (the bug is fixed now).
Asterisk + Junghanns Chan_capi 0.3.4a : use just the latest CVS Head, at least 07/18/2004
Asterisk + ZAPHFC aka bristuff : use 0.1.0 RC2 with CVS Head sources from 07/22/2004
NOTE: RC1 with 07/14/2004 Asterisk CVS Head Sources DO NOT WORK with Nikotel redirect.

Asterisk Stable Version (e.g bristuff 0.0.2) :
There is one bug fix for sip redirect, major rtp code changes, added code to make Asterisk work with promiscious redirect (thanks Mark!) in latest CVS Head sources.
So probably even you spend hours merging patches into stable version, you won't be able to get it running (Keep me up to date, if you do! :) ).

I have only tested with latest Asterisk CVS HEAD!

Thanks Mark!, it was a long night at Saturday 07/17/2004 and I could not send as much money last year as originally expected.
As soon as I had seen Mark's code integration of promiscious redirect into chan_sip.c, app_dial.c, I was really entusiastic to get it finally working.
Personally it took me at least 2 weeks to get a clue what that redirect problem is about.
Please honour Digiums work, if you decide to make use of it.
Of course you can say "Hello" to me too, if you like to (I always love to practice my English conversation skills) :)

And always remember:
Digium + Asterisk rocks!

Greetings from Germany, an Asterisk + Java J2EE enthusiastic IT-Consultant.


UPDATE 07/24/2004
You may have to add to sip.conf a new peer section [] or just Nikotel gateway ip [].
I use both with same settings fromdomain, promiscredir=yes, etc. as in [] or more in your case [nikotel-out].

Another update
Also don't worry, my first test trying to redirect Asterisk callee from a SIP client (SJPhone) to a handy number with SIP 302 Moved temporarily
showed us the following result:
1. Asterisk is being redirected from 99-number to username@nikotel
2. Asterisk will get a new 302 SIP reply and will be forwarded to to sip:<local IP of SJPhone PC>
3. Asterisk is being redirected from sip:<local IP of SJPhone PC> to local extension sip:49<handy nr.>

Asterisk does NOT try to contact 49<handy nr.>@nikotel which would mean YOU would have to pay for being redirected to 0190 or any other PSTN number.
Instead Asterisk follows the behavior for searching the extension in it's local dial plan (LOCAL/) as before as we never would have set promiscredir=yes.

This is the case, because the SIP client directly tries to forward (redirect comes from different IP) and not Nikotel.
And since promiscredir is pinned to Nikotel (IP), only Nikotel can redirect you. But Nikotel does NOT redirect you to any PSTN number.


UPDATE 07/29/2004
You sould get bristuff 0.1.0RC2i, if you want a HFC card working together with Nikotel. It seems that the latest zaphfc RC2i has fixed now one major audio bug (thanks to Kapejod@Junghanns)

About promiscredir - UPDATE 05/25/2005
Something useful to know is that when promiscredir=yes, then Asterisk reads the the contact header information in the "302 Temporarily Moved" SIP PDU and then tries to create a SIP Channel and dial that URI. So if the contact header in the "302 Temporarily moved" reads sip:920121@A.B.C.D, Asterisk will try to Dial SIP/920121@A.B.C.D
If promiscredir=no, then the information in the contact header is treated as a local extension and dialed out as per the local dial plan.

See also

Go back to Asterisk tips and tricks

Created by: jht2, Last modification: Thu 14 of Jun, 2012 (19:40 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+