[Home]

Summary:ASTERISK-16357: chan_mobile unable to connect to cellphone
Reporter:challado (challado)Labels:
Date Opened:2010-07-13 10:34:21Date Closed:2013-01-16 20:30:45.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/chan_mobile
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ASTERISK-16357.diff
( 1) chan_mobile-ASTERISK-16357.patch
Description:Before a Debian Package upgrade, the chan_bluetooth is unable to connect to any cellphone in bluetooth interface. When I try with a old version of debian (stable) all works correctly, but with these new package version the chan_mobile won't works anymore!

I won't change any configuration in chan_mobile.conf file. Only distro upgrade was made!



****** ADDITIONAL INFORMATION ******

Operational System: Linux
Distribution: Debian
Distribution Version: squeeze/sid (Debian Testing)
Kernel Release: 2.6.34.1

Bluetooth Package Base: 4.66-1

Comments:By: Nikolay Ilduganov (ilduganov) 2010-08-23 09:59:07

I've fixed the same problem with fix below. It should work on kernel versions 2.6.7 and greater (http://people.csail.mit.edu/albert/bluez-intro/x502.html). For earlier versions the only way is to go over all channels until success.

Index: chan_mobile.c
===================================================================
--- chan_mobile.c       (revision 283172)
+++ chan_mobile.c       (working copy)
@@ -1381,7 +1381,7 @@
       memset(&addr, 0, sizeof(addr));
       addr.rc_family = AF_BLUETOOTH;
       bacpy(&addr.rc_bdaddr, &src);
-       addr.rc_channel = (uint8_t) 1;
+       addr.rc_channel = (uint8_t) 0;
       if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
               ast_debug(1, "bind() failed (%d).\n", errno);
               close(s);

By: challado (challado) 2010-10-30 08:27:34

The bug still persist in version 1.8 of asterisk. With debian testing, and with kernel 2.6.36 now! In another versions of debian, all works fine. I believe that problem is the bluez package that have any incompatibility issue with new debian version.

By: Nikolay Ilduganov (ilduganov) 2010-10-31 09:57:08

Hi, challado!

can you try the fix above?

By: Leif Madsen (lmadsen) 2010-11-02 09:12:25

I'm going to acknowledge this issue, but the priority of the issue is going to be very low. The solution to this is going to be to use the older version of the bluez package which is supported by chan_mobile, or to get someone from the community to take interest in this issue to resolve it.

By: Leif Madsen (lmadsen) 2010-11-02 09:12:40

You interested in looking at this issue?

By: challado (challado) 2010-11-03 06:27:28

Yep. I have tried the patch but I would not have success. Still have problems.

By: benjamin (benjamin) 2011-03-23 03:32:16

Just wanted to say that this patch worked for me in Debian Squeeze.

By: challado (challado) 2011-04-15 08:31:37

Yep, the patch works too now with SVN-trunk-r313822M and kernel 2.6.38.3

By: Alexander Heinz (alexanderheinz) 2011-05-02 17:10:11

I would also like to confirm that this patch seems to work for Debian squeeze. Any chance that it will be included in the official source code?

By: Malcolm Davenport (mdavenport) 2011-06-02 07:52:45

Another confirmation that the patch works, from the forums:
http://forums.asterisk.org/viewtopic.php?f=1&t=78042

By: David Woolley (davidw) 2011-06-02 09:53:18

You are more likely to get noticed if you submit the patch properly.  I'm surprised lmadsen didn't actually delete it.  The policy is that all patches must be submitted as attachements, after signing the electronic licence agreement, even if they appear trivial and obvious.

This also automatically tags the issue as having a patch, and, I think, automatically sets confirmed status.

Note: only ilduganov can submit the patch.



By: David van Geyn (dataiv) 2012-05-01 08:12:37.184-0500

I can confirm this issue on Ubuntu 11.10 (2.6.3x) and 12.04 LTS (running the 3.x kernel). If I put in the value 0 for rc_channel for letting the kernel choose the first available port, Asterisk connects to my phone using the Handsfree profile. Otherwise the phone will connect to the computer but only on other profiles, and will fail to connect on the Handsfree profile. I guess something else must be using port 1, so either for chan_mobile we should be checking for a free port manually in a loop (for kernel versions < 2.6.7) or using 0 as the channel number (for kernel versions >= 2.6.7).

From http://people.csail.mit.edu/albert/bluez-intro/x502.html:

"The rc_channel field of the socket addressing structure used to bind the socket is simply set to 0, and the kernel binds the socket to the first available port."

By: Alexander Heinz (alexanderheinz) 2012-08-16 11:50:02.791-0500

Please apply this trivial patch. It was already suggested multiple times in the comments.

Thank you!

By: Matt Jordan (mjordan) 2013-01-15 18:29:49.710-0600

The confusion over the status of the patch does not make inclusion of this "trivial patch" easy. Because the original author did not sign a license contributor agreement, we cannot just assume that they are willing to license their contribution. The fact that Alexander Heinz wrote the same patch and attached it is immaterial, as it was not written and attached until long after the issue reporter put the patch in a comment on the issue.

As it is, I've contacted Nikolay Ilduganov to see if he can clarify the situation. He does have a license contributor agreement; if he agrees that the patch can be used we can apply it.

By: Nikolay Ilduganov (ilduganov) 2013-01-15 23:29:08.148-0600

I am attaching patch for my fix. I'll be glad if you accept this tiny contribution.

By: Matt Jordan (mjordan) 2013-01-16 20:12:51.002-0600

Thanks a lot Nikolay!

By: Pete Kirkham (pkirkham) 2019-01-30 09:19:41.354-0600

I'd like to reopen this bug on Ubuntu 18.04 with Asterisk 16.1.1
My phone connects and disconnects as follows:
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3275 handle_response_ok: [galaxy] BSRF sent successfully
]Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:1453 rfcomm_write_full: rfcomm_write() (22) [AT+CIND=?
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3926 do_monitor_phone: [galaxy] read +CIND: ("call",(0,1)),("callsetup",(0-3)),("service",(0-1)),("signal",(0-5)),("roam",(0,1)),("battchg",(0-5)),("callheld",(0-2))
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3926 do_monitor_phone: [galaxy] read OK
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3292 handle_response_ok: [galaxy] CIND test sent successfully
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3294 handle_response_ok: [galaxy] call: 1
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3295 handle_response_ok: [galaxy] callsetup: 2
[Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:3296 handle_response_ok: [galaxy] service: 3
]Jan 30 16:16:36] DEBUG[13226]: chan_mobile.c:1453 rfcomm_write_full: rfcomm_write() (22) [AT+CIND?
[Jan 30 16:16:46] DEBUG[13226]: chan_mobile.c:3894 do_monitor_phone: [galaxy] timeout waiting for rfcomm data, disconnecting
[Jan 30 16:16:46] DEBUG[13226]: chan_mobile.c:3912 do_monitor_phone: [galaxy] timeout while waiting for AT+CIND in response to AT+CIND
[Jan 30 16:16:46]     -- Error initializing Bluetooth device galaxy.
[Jan 30 16:16:46]     -- Bluetooth Device galaxy has disconnected.

This looks to me like the same problem although I see that the code of chan_mobile seems to have integrated the patch proposed.

By: Joshua C. Colp (jcolp) 2019-01-30 10:11:34.368-0600

[~pkirkham] Please create a new issue with details. You should also be aware that chan_mobile has no active maintainer, so it may take some time for the issue to be looked at.