Two terminals / one number / SIP forking?

hello

I am new to the SIP technology. I have registered a SIP line to a provider that only provide me with one line (one “extension” ?). I would like to connect two terminals. That would be my smartphone and my computer (linphone). The idea would be the two phones to ring with the same number, and I would be able to get the conversation with any of them (I don’t want to have two conversations at the same time obviously). As well as being able to place some calls with any of them.

I run a debian web server with a good Internet connexion and I could use it as a SIP server / relay.

Still an asterisk setup sounds a bit complicated at first glance. What would be the simplest solution ? Is there a simpler piece of open source software that would suit my need ? Otherwise what part of the Asterisk documentation should I follow (what functionalities would I need) ?

I’ve found some info about setting up a “mid-registrar” with openSIPS but it also seems to me quite complicated compared to my goal : http://www.opensips.org/Documentation/Tutorials-MidRegistrar

First of all am I using the right terms saying I want to setup a SIP forking functionality using a mid-registrar ?

Thank you in advance !

Use the & operator in the Dial parameter for the extension, to name two different SIP devices.

sorry David, I don’t get your point…

for now i setup my phone using an address such as
sip:0123456789@sip.domain.com

are you saying I should register as sip:0123456789&@sip.domain.com and have two devices connected to the same line ?

I’m not actually sure about pjsip, but I’m talking about the device independent method.

sip:… identifies a device, not an extension.

When you use Dial(), the first parameter is one or more devices, with possible digits to dial, and separated by &s. Having only a single device whose name contains the extension number is a degenerate, and some would argue insecure, case.

See: https://wiki.asterisk.org/wiki/display/AST/Application_Dial

Thank you for your answer, and sorry : I have never used any PBX.

I mean I think I’m looking for a solution that would allow me to setup SIP forking with a gui e.g…
I could eventually adapt a script that already do SIP forking to my needs, but having to learn a framework from scratch is the least option I’d like to follow. (I would if I don’t find any other way).

I would have thought my problem was quite basic and I would easily find something :
one extension number -> two extensions (parallel sip forking on a third-party server)

my mistake : I was scared because dial() was looking like a programming langage function. But actually it is just a rule in extensions.conf. I am currently studying further…

I just setup two “groups” and configure asterisk with my SIP provider.
It is half working : a call to my main phone number rings both phones, and I can pick up but then I have no sound in any direction.
Here is what my config files look like :

extensions.conf

[general]
static=yes
writeprotect=no
clearglobalvars=no
autofallthrough=yes

[work]
include => parkedcalls

exten => _6XXX,1,Dial(SIP/${EXTEN},20,tT)
exten => _6XXX,2,VoiceMail(${EXTEN}@work)

;voicemail number
exten => 600,1,VoiceMailMain(${CALLERID(num)}@work,s)

;call any number to OVH
exten=> _[*#0-9]!,1,Dial(SIP/to-ovh/${EXTEN})

;Call groups
;When 9000 numers 6001 and 6002 both ring for 40 sec, first one to pick up get the call, otherwise then directed message box
exten => 9000,1,Dial(SIP/6001&SIP/6002,40,tT)
exten => 9000,2,Voicemail(6001@work)

[from-ovh]
exten => s,1,Goto(work,9000,1)

users.conf

[general]
hasvoicemail = yes
hassip = yes
hasiax = yes
callwaiting = yes
threewaycalling = yes
callwaitingcallerid = yes
transfer = yes
canpark = yes
cancallforward = yes
callreturn = yes
callgroup = 1
pickupgroup = 1
nat = yes

[template](!)
type=friend
host=dynamic
dtmfmode=rfc2833
disallow=all
allow=ulaw
context = work

[6001](template)
fullname = kro computer
username = kroc
secret = ###secret###

[6002](template)
fullname = kro smartphone
username = kros
secret = ###secret###

sip.conf

[general]
language=fr
bindport=19506
bindaddr=0.0.0.0
srvlookup=yes
canreinvite=no
defaultexpiry=3600
registertimeout=30
registerattempts=0
disallow=all
allow=ulaw
allowguest=yes
nat=yes

register => 0123456789:###secret###@sip3.ovh.fr

[to-ovh]
disallow=all
type=friend
secret=###secret###
host=sip3.ovh.fr
fromdomain=sip3.ovh.fr
fromuser=0123456789
username=0123456789
nat=yes
context=from-ovh
insecure=invite,port
qualify=yes
dtmfmode=inband
allow=ulaw

rtp.conf

[general]
rtpstart=41001
rtpend=41101

I have opened UDP ports 19506 and 41001 to 41101 on my firewall, and I can connect with my both devices on 6001 or 6002@sip.mydomain.com:19506

What am I doing wrong ? Is there a logfile that would explain why there is no sound ?

1 Like

Do not enable allowguest unless you fully understand what it does.

One way audio will not be related to using &. It will be a NAT or Firewall problem.

thanks, i am disabling allowguest !

it’s not one way audio for now, more zero way audio :confused:
I can confirm my ports for RTP as specified in rtp.conf are open for UDP. I doubt I should open them also for TCP… Should I setup a STUN server ?

i’ve added

externip=xxx.xxx.xxx.xxx
localnet=192.168.1.0/255.255.255.0

to [general] in sip.conf and it seems to work fine now !