Total Noob question: Forward all calls to a sip account

Hi, I’m a total asterisk noob. Unfortunately I don’t have the time to read and understand all documentation, and I do not have a clear image of what trunks and extensions etc are.

I am trying to set up a very simple system, so I am wondering if I can do so without spending a lot of time.

I have set up Asterisk 1.6.2.5-0ubuntu1.4 on my ubuntu server (dah). I have a GSM USB modem plugged in and configured (module chan_dongle installed) and it looks operational and connected to the network.

My target is:
have all incoming calls (GSM calls that the dongle will receive) be forwarded to an external SIP account.
The external SIP account is registered with a third party SIP provider and is like external@SIPserver.com.

So the question is, what do I need to do to make this setup work? I’ve already copied template dongle.conf to /etc/asterisk which has the "context=from-trunk " changed. I also have extensions-dongle.conf copied there.

If someone feels I should not be asking this question and I should RTFM please say so politely or not at all. If someone still wants to help, I’d be more than thankful :smile:

Thanks,
Jason

Or you can move this to the job forum.

But it’s not “Commercial and business-oriented” …

Yes it is, because you will need to pay for the consultancy.

Thanks, I’ll end up reading. I’m a student with no time nor money :stuck_out_tongue:

Anyway, which guide would you suggest? I started with this the-asterisk-book.com/1.6/

The standard sources are asteriskdocs.org/, the configuration file samples, the CLI commands core show applications, core show functions, core show application xxxx, etc., and the docs folder of the source tree.

Something basic, like this, should really be covered by the sample extensions.conf.

Note, although the books do tend to lag behind, Asterisk 1.6 is past end of life.

Yeah, I figured this guide was pretty old, but it’s nice cause it’s walking you through. The definitive asterisk book is more like a reference book.

Anyway, I’ll get my GSM part working (problems arose) and come back to it later. Thanks :smile:

Ok, so, I reinstalled Asterisk, version 11.6.0 with chan_mobile enabled. Using a cell phone over bluetooth.

Problem now is:
The calls get from the phone to asterisk but can’t be forwarded to my voipdiscount.com account, which is my target.

My extensions.conf is like this:

[others]
[from-trollphone]
exten => s,1,Dial(SIP/username1@sip.voipdiscount.com,30,rm)
exten => s,2,Hangup[/code]
with username1 replaced of course. 

My sip.conf:
[code][general]
port = 5060
bindaddr = 0.0.0.0
context = others

; Register account at voipdiscount:
register => username2:password@sip.voipdiscount.com/username2

[voipdiscount]
type=friend
context=from-voip-provider
username=username2
fromuser=username2
secret=password
host=sip.voipdiscount.com
fromdomain=stun.voipdiscount.com
qualify=yes
insecure=very
nat=yes[/code]
username2 and password are replaced of course.

I've checked that my receiving phone ([username1@sip.voipdiscount.com](mailto:username1@sip.voipdiscount.com)) is registered and functioning.

Here's asterisk's output while receiving the call:
[code]*CLI>     -- Bluetooth Device Trollphone has connected, initializing...
    -- Bluetooth Device Trollphone initialized and ready.
    -- Executing [s@from-trollphone:1] Dial("Mobile/Trollphone-f8ee", "SIP/username1@sip.voipdiscount.com,30,rm") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/username1@sip.voipdiscount.com
    -- Started music on hold, class 'default', on Mobile/Trollphone-f8ee
    -- Nobody picked up in 30000 ms
    -- Stopped music on hold on Mobile/Trollphone-f8ee
    -- Executing [s@from-trollphone:2] Hangup("Mobile/Trollphone-f8ee", "") in new stack
  == Spawn extension (from-trollphone, s, 2) exited non-zero on 'Mobile/Trollphone-f8ee'
    -- Bluetooth Device Trollphone has disconnected.

Before " – Nobody picked up in 30000 ms" appears there’s a 30’’ pause, but the sip phone (username1@sip.voipdiscount.com) doesn’t ring.

I’ve also tried this line in extensions.conf instead of the one I posted above:

I guess it’s just a matter of correct syntax… any help please?
Thank you for your time

No password on the Dial.

Pointless password in sip.conf, as you are not using it for outgoing calls.

I think insecure=very will be rejected by that version of Asterisk. In any case, you probably don’t need insecure=port, and I think this version of Asterisk supports remotesecret, which is a better way of doing this.

nat=yes without any way of finding the public address looks suspicious, but you are not using this for outbound calls, anyway. nat= may not be needed.

type=friend is bad practice for SIP.

allowguest defaulting to yes is bad security practice, although, with the current dialplan, there is little scope for toll fraud.

fromdomain is suspect, and not having it on the register is questionable. If it is needed, this is another reason why the dial will fail, as it is not specified in the dial paramters.

[quote=“david55”]No password on the Dial.

Pointless password in sip.conf, as you are not using it for outgoing calls.

I think insecure=very will be rejected by that version of Asterisk. In any case, you probably don’t need insecure=port, and I think this version of Asterisk supports remotesecret, which is a better way of doing this.

nat=yes without any way of finding the public address looks suspicious, but you are not using this for outbound calls, anyway. nat= may not be needed.

type=friend is bad practice for SIP.

allowguest defaulting to yes is bad security practice, although, with the current dialplan, there is little scope for toll fraud.

fromdomain is suspect, and not having it on the register is questionable. If it is needed, this is another reason why the dial will fail, as it is not specified in the dial paramters.[/quote]

Thanks so much for the detailed reply! Your comments made it work!!!
Well, kind of. The sipphone->normal voice way does not go through. It’s probably a matter of opening ports on my asterisk server to the public world (it’s behind nat).

I’ll try to fix that, and try to make the opposite call possible too, and report back.

EDIT: Ok, both objectives need NAT fixed… So, here it is: what is the recommended way to solve the NAT problem?
One method is STUN, but I see it has been removed and being remade since 2004.
Port forwarding may or may not be a method, but my 5060 is taken. I changed “port=5061” in my sip.conf’s [general] but I have to somehow let voipdiscount too…

Also, changed rtp.conf and forwarded the appropriate ports.

Make your Asterisk run on port 5061.

Yes, that’s what I want, but how? change it in sip.conf under [general]?

Also, I want to add these (modified accordingly of course):

nat=yes externip=111.111.111.111 fromdomain=my.dynamicdns.com localnet=192.168.1.0/255.255.255.0
somewhere in sip.conf, but should they be inside [voipdiscount] or [general]?

My gsm->SIP broke down and doesn’t work anymore although I didn’t change anything…
Anyway I’m trying to get the opposite working now, which is more important anyway. Incoming call at SIP account should be forwarded to gsm. Do I need to register the registration to voipdiscount too? (different port etc)

All in general, except nat, which you might not need (it is a set of hacks for special cases).

Off the top of my head, you are looking for bindport.

[quote=“david55”]All in general, except nat, which you might not need (it is a set of hacks for special cases).

Off the top of my head, you are looking for bindport.[/quote]

So, it should be something like that? Doesn’t work:

[code][general]
port = 13000
bindaddr = 0.0.0.0
context = others
externip=####
fromdomain=####.####.com
localnet=192.168.1.0/255.255.255.0

; Register account at voipdiscount:
register => username2:password@sip.voipdiscount.com/username2

[voipdiscount]
type=peer
context=from-voip-provider
username=username2
fromuser=username2
secret=password
host=sip.voipdiscount.com
qualify=yes
allowguest=no
nat=yes
bindport=13000
fromdomain=stun.voipdiscount.com[/code]

My wan router forwards port 13000 and 4000 more that are also registered in rtp.conf.
I also tried removing some of the last 3 options in sip.conf but no success

When I call username2@sip.voipdiscount.com from a softphone outside the network, I get “BUSY” immidiately. If I have asterisk shut down, I just get TIME OUT after about half a minute of waiting…

When asterisk is running I get:

*CLI> sip show peers Name/username Host Dyn Forcerport ACL Port Status Description voipdiscount/username2 77.72.169.131 N 5060 OK (96 ms) 1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0 offline]

You shouldn’t have any port overrides in the ITSP section and if you have it right you will need to change the port in the soft phone.

But my softphone never connects to MY asterisk server. It is registered on voipdiscount using another account (username1).

The bindport in the ITSP (voipdiscount) section was to let their server know that it should only try to reach my server through 13000, not 5060. Removed it but still getting LINE BUSY as soon as I dial from username1 to username2

I’d need to take time to check details of the documentation.

You should probably use sip set debug on, to find out exactly what is being exchanged.

So here’s an overview of my setup, to be sure we’re all on the same page:

I have 4 devices:
A SIP phone
A GSM phone 1 with bluetooth
Another GSM phone 2
An asterisk server behind NAT, with ability to port forward but not use port 5060.

Pseudo diagram:

SIP Phone <-----Internet-----> VoipDiscount <-----Internet-------> asterisk <------bluetooth--------> GSMphone1 <-----GSM-----> GSMphone2

SIP phone uses account username1@sip.voipdiscount.com
Asterisk uses account usename2@sip.voipdiscount.com

[quote=“david55”]I’d need to take time to check details of the documentation.

You should probably use sip set debug on, to find out exactly what is being exchanged.[/quote]

yes yes, please take your time.
Thanks a lot for the efforts :smile:
I will try that

EDIT: I can see in the debug info many times “111.111.111.111:5060” where 111… is my IP… I guess this is not very correct…

Update:
changed diaplan patterns from “s” to “_!” and now it works! Well, the other phone rings, but starange things happen when answered. Analyzing the debug info, will report back in a new post.