Dialling a PJSIP extension with 2 registered contacts using TAPI


#1

I have a FreePBX Installation (on Distro v7 but I don’t think this matters) and am trying to do TAPI dialing with PJSIP extensions. I’ve created PJSIP extension 12 and increased the max contacts value to 2 for both extensions.

For extension 12, i have both a SIP client at IP 192.168.1.1 registered and a Sangoma S500 Phone at IP 192.168.1.106. For incoming external and internal calls everything works fine and both devices at extension 12 ring.

pjsip show contacts lists the following:

  • Contact: 12/sip:12@192.168.1.106:5060 a7913904e6 Avail 8.934
  • Contact: 12/sip:12@192.168.1.1:5060;uniq=072004C09F0721 b79cc6d103 Avail 12.593

I’m using phonesuite TAPI for asterisk to dial from windows (http://www.phonesuite.de/de/produkte/ast_tsp/phonesuite_tapi_for_asterisk.htm)

The TAPI configuration suggests using PJSIP/12 (instead of normally using SIP/12) in the configuration (field “Channel”). But when doing this only one phone registered to extension 12 rings.

I tried a lot and found that by entering PJSIP/12/sip:12@192.168.1.1:5060 as string in the “Channel” field of the TAPI application, I can make it ring the other phone. But it doesn’t really work well (the dialing application quickly thinks the call got interrupted and the asterisk console shows “Request to hangup non-existent channel: PJSIP/12/sip:12@192.168.1.1:5060” even though the call is in progress).

So how do I dial my 2 contacts which are both registered as endpoint 12? I want to be able to pick up any one of the 2 phones available for the extension and have it start the TAPI call from the one which is answered.

Am I the first one to wonder how this can be done? Somehow I doubt that and hope that someone has figured this out already :slight_smile:


(Lorne Gaetz) #2

Try a dial string of:

local/12@from-internal

#3

Thank you very much!

Dialling “local/12” instead of PJSIP/12 works! (context is set in a separate context field in this TAPI driver)
Both phones ring and I can answer one of them to start the call.

There is one problem remaining though: I cannot hang up using the hang up button in the windows app now (does nothing). And hanging up the phone does not cause the application to register it. Which probably means it cannot record call length. If anyone can suggest further improvements to solve this it would be perfect, but I’m pretty happy with the “local/12” solution even without any further improvements :slight_smile:

NOTICE[7574]: manager.c:4309 action_hangup: Request to hangup non-existent channel: local/12

#4

Has something changed here? I have the same problem again on a FreePBX 15 system with Asterisk 16.9.0 and when setting the Asterisk TAPI driver to dial “local/26” with context “from-internal” I get the following in the asterisk console:

[2020-04-27 17:54:57] NOTICE[11101]: core_local.c:734 local_call: No such extension/context 26@default while calling Local channel

When dialing PJSIP/26 it works, but again only one of the phones is ringing. Is there a better solution to this, now, 3 years later?


(Lorne Gaetz) #5

Error is right there, you’re using default, not from-internal context.


(Dave Burgess) #6

The “right” way to fix this is to make sure that the TAPI interface doesn’t use the ‘default’ context.

A horrible solution to this problem is to add a "default’ context in /etc/asterisk/extension_custom.conf and the make it ‘Goto(from-internal,s,1)’.

It’s a horrible solution and will probably break something, but if you can’t get the TAPI interface to do the right thing, it may be your only solution.


#7

Thank you both. I’ve now done some additional investiation:

The problem started with FreePBX 15 !

I’ve taken the PBX from another company which was on FreePBX 14 and configured the Phonesuite TAPI for Asterisk driver to dial local/10. Everything worked, phone 10 was ringing when dialing.

Then I proceeded with the update from FreePBX 14 to FreePBX 15, changed NOTHING AT ALL on the TAPI Client! And now this system also fails with

[2020-04-27 19:24:03] NOTICE[13638]: core_local.c:734 local_call: No such extension/context 10@default while calling Local channel
[2020-04-27 19:24:05] NOTICE[13636]: manager.c:4488 action_hangup: Request to hangup non-existent channel: local/10

when dialing local/10
Something has changed from FreePBX 14 to 15, the client is configured exactly the same as it always was:


#8

I saved logs from what is sent to the Asterisk Manager interface (on the FreePBX 15 system where the problem is occuring):

Log from Phonesuite TAPI for Asterisk v1.1.123 (unsuccessful call)

https://pastebin.com/HMd1SiiC

Sucessful call to PJSIP/18, output from “manager set debug on”

https://pastebin.com/e3pKfeAP

Unsucessful call to local/18, output from “manager set debug on”

https://pastebin.com/B9DmUSNv

In my opinion the call is originated correctly, from “from-internal” and it’s FreePBX that then weirdly does not handle it correctly. Don’t really understand it - I have some mild SIP debugging skills but I have so far never looked at AMI logs…

If someone has a better insight I would appreciate that very much.


#9

I’ve now gotten it to work mostly after randomly trying things with these slightly weird settings:

Still kind of sad that FreePBX broke it and nobody except me seems to care.


#10

Your software provider might care if you report this back to them and they want their TAPI software to continue to be compatible with FreePBX.


#11

I see no reason whatsoever why this is a bug in the TAPI software and not one in FreePBX 15.


#13

What version of Asterisk were you using on the FreePBX 14 system?


#14

By the way, you might get a better result if instead of using the from-internal context to reach your endpoints you create a new context in the /etc/asterisk/extensions_custom.conf file like this:

[from-tapi]
exten => _X.,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})

and then in the TAPI initiate your call with the Local/number@from-tapi channel

The context that you set below should still be “from-internal”

I looked over it again and you definitely had a configuration error before (I don’t know why it worked in FreePBX 14 but it should not have) - the Local channel has to be specified with a context. It does not inherit the calling context (from-internal that you specified elsewhere on the screen).


#15

I’ve been using pretty recent Asterisk versions, I’m pretty sure I was at Asterisk 16 LTS on FreePBX 14 and on the same version (initially) on FreePBX 15. Tried all available versions to fix this, didn’t help.

I’ve now studied the “manager set debug on” logs a bit more closely:
When I only set Context: from-internal the “Action: Originate” command comes with the correct context “from-internal”, but the Newchannel Event which follows is then in “Context: default”. Which it should not be!

As I understand this, “Events” come from the Asterisk/FreePBX system while the “Action:” comes from the client. So this is not something that TAPI for Asterisk is sending.

NOT WORKING EXAMPLE:
<— Examining AMI action: -->
Action: Originate
Channel: local/18
Context: from-internal
Exten: 08003301000
Priority: 1
Async: 1
CallerID: "PC (TAPI) "<>
ActionID: 30-srv0000024B71E10727
Variable: ORIGINATE_VAR_CALLER_ID=18

ACTUALLY WORKING EXAMPLE WITH CONTEXT SPECIFIED TWICE:
<— Examining AMI action: -->
Action: Originate
Channel: local/18@from-internal
Context: from-internal
Exten: 08003301000
Priority: 1
Async: 1
CallerID: "PC (TAPI) "<>
ActionID: 20-srv0000024B71E10727
Variable: ORIGINATE_VAR_CALLER_ID=18

When the TAPI driver sends the PBX an Action: Originate in context: from-internal and then the PBX responds with an event in context default, this looks A LOT like a bug in the PBX.


#16

Context is related to the extension and not to the channel.

The AMI shows you are using channel: Local/18@from-internal to call exten: 08003301000 in context: from-internal.

A channel does not actually belong to a context. “Local” channel is a special type which starts a “fake” channel using dialplan - that’s why you need to include the context as part of it, like Local/18@from-internal.

Sorry I can’t explain this more clearly. But your “Actually working example” is the way it is supposed to work and I do not think there is any bug whatsoever.


#17

Thank you very much for your help and time billsimon !


(Christoph Scheidl) #18

Hello @Gerald,
how did you successfully do it now?
When i type Local/22@from-internal into the Channel of xtelsio TAPI for Asterisk Settings, the application cuts off the “-internal” part and does not call the phones.
Looking forward to your answer!
All the best!
ChESch


(Christoph Scheidl) #19

Okay never mind!
I have overlooked the fact that in the last line of your screenshot you typed the “other channel”.
It is also stated here
Have a nice day!


(Lorne Gaetz) closed #20

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.