Chan_mobile and freepbx

Hi,

I’ve successfully paired my phone with my Asterisk server using chan_mobile and now I can see it connected with “mobile show devices” command:

raspbx*CLI> mobile show devices
ID Address Group Adapter Connected State SMS
Myphone DC:74:XX:07:XX:XX 1 pabx Yes Free No

Now I want to define a trunk using this channel. But I could not figure out how.

My chan_mobile.conf is like:

[general]
interval=30             ; Number of seconds between trying to connect to devices.

;;;;;;;;;MyConfig

[adapter]
id=pabx
address=B8:27:XX:7C:XX:XX ;just hidden real MAC

[Myphone]
address=DC:74:XX:07:XX:XX
port=3
context=from-MySipphone
adapter=pabx
group=1

how can I define the trunk on Freepbx GUI ?
as I read in some instructions , I need something similar to below for the conf files but I don’t want to modify conf files on a FReepbx installation. So the better way is to define the trunk on GUI. Am I correct ?

[test]
exten => _X.,1,Dial(Mobile/Myphone/${EXTEN},45)
_X.,n,Hangup

[incoming-mobile]
exten => s,1,Noop(Accepting mobile call from ${DID})
exten => s,n,Dial(SIP/test)

Please, I need help.

Create a Incoming Route with DID set to 0123 and set destination after.

[incoming-mobile]
exten => s,1,Noop(Entering macro-from-mobile-custom-1 with DID = ${DID} and setting to: 0123)
exten => s,n,Set(__FROM_DID=0123)
exten => s,n,Goto(from-trunk,0123,1)

I don’t have any experience with Chan_mobile, but if this were a normal sip trunk, you do two things:

Incoming - Set the trunk context to from-trunk so that incoming calls reach your inbound routes

Outgoing - Create a trunk of type ‘custom’ and use a custom dial string of Mobile/Myphone/$OUTNUM$ then add your new trunk to outbound routes as appropriate.

thanks but as I wrote above I don’t want to modify conf files on a Freepbx platform which is configured through GUI.
How can I create a trunk with MOBILE channel ?

I know how to do it with SIP trunks but I don2t know how to create a trunk for chan mobile.
So shouldn’t I first create a “custom trunk” ? How can I do it for MOBILE channel ?

thanks. I created the trunk as you suggested and it works. At least the call is router from extension to mobile device and itmakes the call.
However, there is no sound (both directions)

state on Asterisk:>

raspbxCLI> core show calls
1 active call
9 calls processed
raspbx
CLI> core show channels
Channel Location State Application(Data)
SIP/995-00000001 [email protected] Up Dial(Mobile/Myphone/903362284
Mobile/Myphone-ce01 (None) Up AppDial((Outgoing Line))
2 active channels
1 active call
9 calls processed

What may be the problem ?

And for the incoming route I created a route with ANY CID and ANY DID. However it didn’t catch the call .

Here’s the log from Asterisk:

[2018-01-17 19:03:19] NOTICE[29312]: res_pjsip/pjsip_distributor.c:649 log_failed_request: Request ‘INVITE’ from ‘“47002” sip:[email protected]’ failed for ‘185.40.4.49:5070’ (callid: f0fc53d41f996b46436228fac5f604a7) - No matching endpoint found
[2018-01-17 19:05:13] WARNING[29660][C-00000007]: pbx.c:4416 __ast_pbx_run: Channel ‘Mobile/Myphone-d9d5’ sent to invalid extension but no invalid handler: context,exten,priority=from-MySipphone,s,1

what is wrong ?

This usually indicates you are trying to pick up an extension from Chan-SIP on a PJ-SIP port (or vice versa).

The error message says that you tried to send the call to a context called “from-MySipphone” with a ‘s’ matching extension and priority of ‘1’, and that combination of context, extension, and priorotity doesn’t actually exist. Look in your extensions*conf files and see if you can find the ‘from-MySipphone’ context. If not, you may need to add it to your extensions_custom.conf file.

is it “ok” to modify conf files when using Freepbx ?

and what about the “no audio” problem when calling outside ?

It depends on the file. All of the “*_custom.conf” files are there for you to use and abuse. There is lots of information on this in the Wiki.

That is called “one-way audio” and even more has been written about that. I expect a Google search for “Asterisk one-way audio” will turn up several million hits, most of which will tell you about how NAT needs to be set up and how to configure your inbound router.

ok. after changing the context in chan_mobile.conf to “from-trunk” and creating an inbound route with ANY DID and ANY CID , now the incoming call reaches destination extention. Call gets connected but again “no audio”

it is not “one way audio”, because there’s no audio on both direction. And since this is not Sip, I think “lots of information on sip one way audio” will not help me here. This is specific to mobile channel.

is there anyone who has experience with that here ?

thanks.

I’ve found here something about it:

it suggests to downgrade Asterisk to v11. Is there an easy way of doing it ?

and here are similar other threads:
http://forums.asterisk.org/viewtopic.php?f=1&t=23594&start=0

Thanks.

I’m pretty sure there’s no way back to 11.

Downgrading to get this working seems like a terrible idea.

You are having one-way audio problems in both directions. I knew that when I suggested the problem was NAT and your Firewall. This is almost always problems with NAT and firewall configuration. You can fight us on it all you want, but until you are absolutely certain your firewalls, port, and NAT configurations are correct, downgrading to Asterisk 11 is a 10 year old answer.

https://wiki.freepbx.org/pages/viewpage.action?pageId=3571781

ok. I know this is not a NAT or Firewall issue because this is not SIP.
Besides I also have a SIP trunk on the same Asterisk setup and it works fine. So SIP-to-SIP is fine, but SIP-to-MOBILE is not.
There is a problem preventing the audio flow. Anybody who has experience with chan_mobile could help me…

I set debug level 1 on Asterisk.

I get :
[2018-01-18 01:36:10] DEBUG[8288][C-00000002]: audiohook.c:272 audiohook_read_frame_both: Read factory 0x6de69efc and write factory 0x6de6a91c both fail to provide 160 samples

while ringing.

and I get :
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:333 audiohook_read_frame_both: Failed to get 160 samples from write factory 0x6de6a91c
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:272 audiohook_read_frame_both: Read factory 0x6de69efc and write factory 0x6de6a91c both fail to provide 160 samples
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:333 audiohook_read_frame_both: Failed to get 160 samples from write factory 0x6de6a91c
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:272 audiohook_read_frame_both: Read factory 0x6de69efc and write factory 0x6de6a91c both fail to provide 160 samples
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:333 audiohook_read_frame_both: Failed to get 160 samples from write factory 0x6de6a91c
[2018-01-18 01:36:20] DEBUG[8288][C-00000002]: audiohook.c:272 audiohook_read_frame_both: Read factory 0x6de69efc and write factory 0x6de6a91c both fail to provide 160 samples

when the phone is answered.
could this help?

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