SIP B2B calls with Asterisk?

Hi, that’s my first post on this forum and I need your help cause I stuck when configuring my Asterisk.

I’m wondering if it’s possible to place B2B SIP calls from Asterisk so that I can put lets say john.doe@abc.com in my softphone and Asterisk will do a DNS lookup for a relevan SRV record for abc.com and route my call to proper abc.com B2B gateway? Besides, I’m coming from Cisco world where there’s a specific system called Expressway which is designed for making B2B calls.

BTW, I’m using PJSIP channel stack.

Any relevant extensions.conf and pjsip.conf excerpts would be appreciated.

I’m not sure what B2B means in this context. To me it means a business to business sale.

Asterisk can make calls to SIP URIs, although, at least at one time, it only tried one SRV candidate, when such were present.

In this case, the dialplan would need to retrieve the domain part. chan_sip puts that in a variable.

How can I make Asterisk to look up the domain? With the config below it looks up for an endpoint with a domain name I call which is 1@example.com.

extensions.conf:
exten = _[a-zA-Z1-9@].,1,NoOp(SIPDOMAIN is ${SIPDOMAIN}, EXTEN is ${EXTEN})
same = n,Dial(PJSIP/${EXTEN})

Debug from CLI:

 Setting global variable 'SIPDOMAIN' to 'X.X.X.X'
    -- Executing [1@example.com@from-internal:1] NoOp("PJSIP/6001-0000000d", "SIPDOMAIN is X.X.X.X, EXTEN is 1@example.com") in new stack
    -- Executing [1@example.com@from-internal:2] Dial("PJSIP/6001-0000000d", "PJSIP/1@example.com") in new stack
[2017-11-04 21:35:19] ERROR[17892]: chan_pjsip.c:2410 request: Unable to create PJSIP channel - endpoint 'example.com' was not found
[2017-11-04 21:35:19] WARNING[18010][C-0000000e]: app_dial.c:2510 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)

An endpoint must always be specified, and PJSIP speaks in URIs. Given that an endpoint named ‘outgoing’ exists:

PJSIP/outgoing/sip:1000@test.com

1 Like

Thank you @jcolp, works like a charm now!

I guess, you are about a Back-to-Back User Agent (B2BUA). However, in your context from the view of your SIP phone, the term ‘Outbound Proxy’ would fit as well. When you want to dial any SIP-URI, you run into issues because Asterisk does not know when you want to dial an internal extension and when to dial the whole URI automatically. In my scenario, every extension had to be filtered whether the domain was local. For more details, see ASTERISK-26670…

Instead, did you consider to use the traditional channel driver chan_sip?

@traud, thanks for you reply and yes, B2BUA is what I was about. Besides, I’ve started working wih res_pjsip and I think I’ll stick with that. How can I set a local domain name so the Asterisk knows that a call should be resolved locally?

I am not aware of such a local-domain feature. Instead, I had to filter at the start of each extension. There, I used what is described in ASTERISK-26670. If somebody comes up with an easier solution, I would love to read about it.