Connecting 2 pbx to make outb./inb. calls (no trunking)

Hi everybody! I’ve to make a particoular kind of configuration and I hope you could help me.
I need to interconnect two asterisk pbx (call them pbxA and pbxB). pbxA has two network interface (one with private ip and one with public ip). It doesn’t have zaptel interface and the only kind of phones that I will use are softphones. pbxB has a public ip and, who manage this server, tell me that they created an extension (they give me usr and psw) with also an associated geographic number for me. pbxB can call external number (pstn) so I need to use pbxB to make and receive calls from pstn. How can I configure the two pbx to make this kind of configuration?

  1. Client1 and Client2 call each other on the internal lan using pbxA (OK… no problem. It’s simple);
  2. Client1 call +390267xxxxx (a generic pstn user) using pbxB extension;
  3. +390267xxxxx call Client1 (or Client2) using the geographical number associated at the extension that they create for me.

Inbound and Outbound calls using SIP (we prefer SIP for our study).
Last thing but the most important: I can’t use trunking. My pbxA have to be like a simple phone for pbxB.
Is it possible?

Thank you very much!!!

I’ve edited the original post. The problem is little changed. Could somebody help me? Thank you!!!

Asterisk cannot, yet, distinguish between trunking and a single phone. There is no real difference in SIP (or, I think) IAX.

Is asterisk as a sip client a solution for my problem?

voip-info.org/wiki/view/Aste … g+sip.conf

Probably, but that is also something you would do over a trunk. To be sure one would need to know exactly how the other system was configured.

Incidentally, the terminology is confusing as Asterisk is always a SIP client when using SIP! What they actually mean is a client to a SIP registrar.

My service provider could say me only that I have an extension (he says me only extension number, user, psw, and his public ip). How can I solve? Have you got an idea? Thank you very much for your support!

That is a very standard configuration for accessing a provider. If they permit the use of their service from Asterisk, they should be able to provide you with the necessary configuration. If they won’t, just try plugging the parameters into the register example that you have.

There are also examples of this in sip.conf.samples, in the source code.

You would have avoided some confusion by saying that you were talking about a provider, rather than some other part of your organisation.

As I said, there is no real difference between a trunk and an extension, as far as Asterisk is concerned, although, for commercial reasons, the other end may limit the number of calls on what they consider to be an extension.

This area is covered on pages 202-204 of Asterisk: The Future of Telephony.

Hi! Thank your answer. This is the configuration that I’m trying:

SIP.CONF

[general]

context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes

externip=nnn.nnn.nnn.nnn ;ip address of pbxA that have to be a normal sip phone for pbxB
localnet=192.168.11.0/255.255.255.0;

register=>5091:5091@xxx.xxx.xxx.xxx/6000 ; xxx.xxx.xxx.xxx is the ip address of pbxB
registerattempts=10
registertimeout=20

[6000]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6000
secret=6000
context=smart

[6001]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6001
secret=6001
context=smart

[6002]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6002
secret=6002
context=smart

[c-out]
type=friend
secret=5091
username=5091
host=xxx.xxx.xxx.xxx
fromuser=5091
canreinvite=no
insecure=very
qualify=yes
nat=yes
context=from-c

EXTENSIONS.CONF

[general]

static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=no

[smart]

exten => _0.,1,Dial(SIP/${EXTEN:1}@c-out,30,r)
exten=>6000,1,Dial(SIP/6000)
exten=>6001,1,Dial(SIP/6001)
exten=>6002,1,Dial(SIP/6002)

[from-c]
exten => 6000,1,Answer

With SIP Debut set on, the CLI show me that:

SIP SHOW REGISTRY

Host dnsmgr Username Refresh State Reg.Time
xxx.xxx.xxx.xxx:5060 N 5091 105 Registered Tue, 25 May 2010 16:23:03
1 SIP registrations.

SIP SHOW PEERS

Name/username Host Dyn Nat ACL Port Status
6000/6000 nnn.nnn.nnn.nnn D 5061 Unmonitored
6001/6001 (Unspecified) D 5060 Unmonitored
6002/6002 (Unspecified) D 5060 Unmonitored
c-out/5091 xxx.xxx.xxx.xxx N 5060 OK (1 ms)
4 sip peers [Monitored: 1 online, 0 offline Unmonitored: 3 online, 0 offline]

SIP SHOW PEERS c-out

  • Name : c-out
    Secret :
    MD5Secret :
    Remote Secret:
    Context : from-c
    Subscr.Cont. :
    Language :
    AMA flags : Unknown
    Transfer mode: open
    CallingPres : Presentation Allowed, Not Screened
    FromUser : 5091
    Callgroup :
    Pickupgroup :
    Mailbox :
    VM Extension : asterisk
    LastMsgsSent : 32767/65535
    Call limit : 0
    Dynamic : No
    Callerid : “” <>
    MaxCallBR : 384 kbps
    Expire : -1
    Insecure : no
    Nat : Always
    ACL : No
    T.38 support : No
    T.38 EC mode : Unknown
    T.38 MaxDtgrm: -1
    DirectMedia : No
    PromiscRedir : No
    User=Phone : No
    Video Support: No
    Text Support : No
    Ign SDP ver : No
    Trust RPID : No
    Send RPID : No
    Subscriptions: Yes
    Overlap dial : No
    DTMFmode : rfc2833
    Timer T1 : 500
    Timer B : 32000
    ToHost : xxx.xxx.xxx.xxx
    Addr->IP : xxx.xxx.xxx.xxx Port 5060
    Defaddr->IP : 0.0.0.0 Port 5060
    Prim.Transp. : UDP
    Allowed.Trsp : UDP
    Def. Username: 5091
    SIP Options : (none)
    Codecs : 0x8000e (gsm|ulaw|alaw|h263)
    Codec Order : (none)
    Auto-Framing : No
    100 on REG : No
    Status : OK (1 ms)
    Useragent :
    Reg. Contact :
    Qualify Freq : 60000 ms
    Sess-Timers : Accept
    Sess-Refresh : uas
    Sess-Expires : 1800 secs
    Min-Sess : 90 secs
    Parkinglot :

This is the problem: X-lite register me correctly with 6000 user. Then, when I digit the number (with zero in front of it), I have the response that is “Ringing” but the phone that I’m calling does not ring and after some tryes, I receive this error: Call Failed: 603 Declined. These are some messages that I have on my CLI:

== Using SIP RTP CoS mark 5
– Executing [034090xxxxx@smart:1] Dial(“SIP/6000-0000000e”, “SIP/34090xxxx@c-out,30,r”) in new stack
== Using SIP RTP CoS mark 5
– Called 34090xxxxx@c-out
– SIP/c-out-0000000f is ringing
– Nobody picked up in 30000 ms
– Auto fallthrough, channel ‘SIP/6000-0000000e’ status is ‘NOANSWER’

With SIP DEBUG SET ON:

Found audio description format telephone-event for ID 101
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0x60e (gsm|ulaw|alaw|speex|ilbc)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xe (gsm|ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port nnn.nnn.nnn.nnn:8000
Looking for 034090xxxx in smart (domain nnn.nnn.nnn.nnn)
list_route: hop: sip:6000@nnn.nnn.nnn.nnn:5061

<— Transmitting (no NAT) to nnn.nnn.nnn.nnn:5061 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5061;branch=z9hG4bK1F1E99DC451631F383FE359E5BCFA0E8;received=nnn.nnn.nnn.nnn;rport=5061
From: 6000 sip:6000@nnn.nnn.nnn.nnn:5061;tag=1832930847
To: sip:034090xxxx@nnn.nnn.nnn.nnn
Call-ID: 4B2D13A6-60F7-FD65-5971-9C86713ED400@192.168.11.51
CSeq: 61116 INVITE
Server: Asterisk PBX 1.6.2.7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: sip:034090xxxxx@nnn.nnn.nnn.nnn
Content-Length: 0

<------------>
– Executing [0340xxxx@smart:1] Dial(“SIP/6000-00000010”, “SIP/34090xxxxx@c-out,30,r”) in new stack
== Using SIP RTP CoS mark 5
Audio is at nnn.nnn.nnn.nnn port 13752
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to xxx.xxx.xxx.xxx:5060:
INVITE sip:34090xxxx@xxx.xxx.xxx.xxx SIP/2.0
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5060;branch=z9hG4bK76da9fdb;rport
Max-Forwards: 70
From: “6000” sip:5091@nnn.nnn.nnn.nnn;tag=as0273c117
To: sip:34090xxxx@xxx.xxx.xxx.xxx
Contact: sip:5091@nnn.nnn.nnn.nnn
Call-ID: 045c1b0b18130caa3825ebe6312fe0a8@nnn.nnn.nnn.nnn
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.7
Date: Tue, 25 May 2010 14:41:50 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 310

v=0
o=root 412613583 412613583 IN IP4 nnn.nnn.nnn.nnn
s=Asterisk PBX 1.6.2.7
c=IN IP4 nnn.nnn.nnn.nnn
t=0 0
m=audio 13752 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


– Called 34090xxxxx@c-out

<— Transmitting (no NAT) to nnn.nnn.nnn.nnn:5061 —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5061;branch=z9hG4bK1F1E99DC451631F383FE359E5BCFA0E8;received=nnn.nnn.nnn.nnn;rport=5061
From: 6000 sip:6000@nnn.nnn.nnn.nnn:5061;tag=1832930847
To: sip:034090xxxxx@nnn.nnn.nnn.nnn;tag=as302c7132
Call-ID: 4B2D13A6-60F7-FD65-5971-9C86713ED400@192.168.11.51
CSeq: 61116 INVITE
Server: Asterisk PBX 1.6.2.7
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: sip:034090xxx@nnn.nnn.nnn.nnn
Content-Length: 0

<------------>

<— SIP read from UDP:xxx.xxx.xxx.xxx:5060 —>
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5060;branch=z9hG4bK76da9fdb;received=nnn.nnn.nnn.nnn;rport=5060
From: “6000” sip:5091@nnn.nnn.nnn.nnn;tag=as0273c117
To: sip:34090xxxx@xxx.xxx.xxx.xxx;tag=as7ed37f0a
Call-ID: 045c1b0b18130caa3825ebe6312fe0a8@nnn.nnn.nnn.nnn
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Proxy-Authenticate: Digest algorithm=MD5, realm=“xxx.xxx.xxx.xxx”, nonce="4dc639ea"
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Transmitting (NAT) to xxx.xxx.xxx.xxx:5060:
ACK sip:34090xxxx@xxx.xxx.xxx.xxx SIP/2.0
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5060;branch=z9hG4bK76da9fdb;rport
Max-Forwards: 70
From: “6000” sip:5091@nnn.nnn.nnn.nnn;tag=as0273c117
To: sip:34090xxxx@xxx.xxx.xxx.xxx;tag=as7ed37f0a
Contact: sip:5091@nnn.nnn.nnn.nnn
Call-ID: 045c1b0b18130caa3825ebe6312fe0a8@nnn.nnn.nnn.nnn
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.6.2.7
Content-Length: 0


Audio is at nnn.nnn.nnn.nnn port 13752
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to xxx.xxx.xxx.xxx:5060:
INVITE sip:34090xxxxx@xxx.xxx.xxx.xxx SIP/2.0
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5060;branch=z9hG4bK0824e476;rport
Max-Forwards: 70
From: “6000” sip:5091@nnn.nnn.nnn.nnn;tag=as0273c117
To: sip:34090xxxx@xxx.xxx.xxx.xxx
Contact: sip:5091@nnn.nnn.nnn.nnn
Call-ID: 045c1b0b18130caa3825ebe6312fe0a8@nnn.nnn.nnn.nnn
CSeq: 103 INVITE
User-Agent: Asterisk PBX 1.6.2.7
Proxy-Authorization: Digest username=“5091”, realm=“xxx.xxx.xxx.xxx”, algorithm=MD5, uri="sip:34090xxx@xxx.xxx.xxx.xxx", nonce=“4dc639ea”, response="e3e189d9d108005e99abc496907a94bd"
Date: Tue, 25 May 2010 14:41:50 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 310

v=0
o=root 412613583 412613584 IN IP4 nnn.nnn.nnn.nnn
s=Asterisk PBX 1.6.2.7
c=IN IP4 nnn.nnn.nnn.nnn
t=0 0
m=audio 13752 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------->
— (11 headers 0 lines) —
Really destroying SIP dialog '045c1b0b18130caa3825ebe6312fe0a8@nnn.nnn.nnn.nnn’ Method: INVITE
<— SIP read from UDP:nnn.nnn.nnn.nnn:5061 —>
ACK sip:034090xxxxx@nnn.nnn.nnn.nnn SIP/2.0
Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5061;rport;branch=z9hG4bK1F1E99DC451631F383FE359E5BCFA0E8
From: 6000 sip:6000@nnn.nnn.nnn.nnn:5061;tag=1832930847
To: sip:034090xxxx@nnn.nnn.nnn.nnn;tag=as302c7132
Contact: sip:6000@nnn.nnn.nnn.nnn:5061
Call-ID: 4B2D13A6-60F7-FD65-5971-9C86713ED400@192.168.11.51
CSeq: 61116 ACK
Max-Forwards: 70
Content-Length: 0

If you have some ideas… I really don’t know wich is the problem… thank you very much! have a nice day! :wink:

The trace is incomplete, but shows nothing wrong as far as it goes.

Hi! I solved the 603 problem. pbxB was setted to put itself a zero to make outbound calls. So when I want to have an outbound call I’ve to digit 00xxxxxxxx and not 0xxxxxxxx. I solved also some codec problem allowing only ulaw and gsm. These are the updated config files.

SIP.CONF

[general]

context=from-c
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes

disallow=all
allow=ulaw
allow=gsm

externip=nnn.nnn.nnn.nnn
localnet=192.168.11.0/255.255.255.0;

register=>5091:5091@xxx.xxx.xxx.xxx/1234
registerattempts=10
registertimeout=20

[6000]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6000
secret=6000
context=smart

[6001]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6001
secret=6001
context=smart

[6002]

type=friend
host=dynamic
dtmfmode=rfc2833
username=6002
secret=6002
context=smart

[c-out]
type=peer
secret=5091
username=5091
host=xxx.xxx.xxx.xxx
fromuser=5091
canreinvite=no
insecure=very
qualify=yes
nat=yes
context=from-c

EXTENSIONS.CONF

[general]

autofallthrough=yes
static=yes
writeprotect=no
clearglobalvars=no
priorityjumping=no

[smart]

exten => _0.,1,Dial(SIP/${EXTEN:1}@c-out,30,r)
exten=>6000,1,Dial(SIP/6000)
exten=>6001,1,Dial(SIP/6001)
exten=>6002,1,Dial(SIP/6002)

[from-c]
exten => 1234,1,Answer
exten => 1234,2,Dial(SIP/6000,25,Ttr)
exten => 1234,3,Hangup

Now, the last probems to solve, are inbound calls (from-c). I actually can make outbound calls but not inbound calls. If I try to call the geographic number associated at 5091 extension the call is rejected.
I acquire some traffic information by wireshark and I see that there are some SIP INVITE messages from [6000] to the pbxB ip address and I don’t want this. [6000] must be hidden for pbxB. [6000] mustn’t register itself on pbxB and pbxA have to be like a simple softphone for pbxB. Have you got some ideas?

A friend say me to try putting this code in sip.conf:

useragent=X-Lite release 1104o stamp 56125
sdpsession=X-Lite release 1104o stamp 56125
sdpowner=X-Lite release 1104o stamp 56125

What do you think about?
I also see that someone use this lines in sip.conf:

trustrpid = yes
sendrpid = yes

Should I use them? What does they mean? Thank you very much for your support. I feel that we’re near the solution. Thank you.

[quote]A friend say me to try putting this code in sip.conf:

useragent=X-Lite release 1104o stamp 56125
sdpsession=X-Lite release 1104o stamp 56125
sdpowner=X-Lite release 1104o stamp 56125[/quote]

That seems the sort of thing someone might want to do abuse a service intended for phones which was using technical measures to enforce the restriction. As you can already make outgoing calls, I don’t think there would be any point.

On a first reading, I think you need to read more about SIP registration, and Asterisk contexts.

[quote]trustrpid = yes
sendrpid = yes

Should I use them? What does they mean? [/quote]

Asterisk: The Future of Telephony pages 356 and 358
google.co.uk/search?hl=en&q= … +rfc&meta=

Page 359

However, if this is a permitted use of the service, the service operator will be happy to tell you exactly how to set up Asterisk. If it is not a permitted use, you should change to a service that does permit it.