[Home]

Summary:ASTERISK-12938: Blackberry Pearl (8100) rarely initialises
Reporter:ciaranm (ciaranm)Labels:
Date Opened:2008-10-20 08:18:11Date Closed:2010-08-25 15:09:26
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Addons/chan_mobile
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_mobile_blackberry1.diff
Description:Fedora 9, bluez-3.35-1 (rpms) Asterisk 1.6.0-beta9 from RPM and asterisk-addons-1.6.0-rc1 from source.

When using a blackberry pearl (8100) I need to unload and load chan_mobile multiple times before the state moves from Init to Free. Chan mobile working great with other phones (e.g. Nokia).
Blackberry appears to not respond consistently to (or response may be missed?) AT+CIND=? however if I attempt to work around this by issuing AT+CMER=3,0,0,1 manually the BB appears to initialise but the connection is lost when I recieve a call (has occasionally caused BB to reboot also!). If the BB does (after repeated attempts) initialise properly then it works correctly for the duration of that connection.

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

Currently using (extremely nasty) shell script to unload and load chan_mobile if it spots that the blackberry is connected but not initialised! Initialisation usually suceeds seomwhere between the 4th and 10th unload and load.

I can supply further debug info (hcidump?) and test with the offending device as required.

Many thanks

Ciaran
Comments:By: Leif Madsen (lmadsen) 2008-10-21 09:17:59

I'm going to acknowledge this issue as it appears you have provided all the initial information necessary to start debugging this issue, but unfortunately I'm not sure who I can assign this to, and thus, this issue may remain open for some time to come :(

By: Leif Madsen (lmadsen) 2008-10-21 09:45:32

Upon file's suggestion, I'm assigning this to qwell. Blame him should you choose not to accept your mission. This message shall self destruct in some period of time.

By: BrettS (ughnz) 2008-11-01 05:52:16

I have this problem with another phone.

I have fixed it by adding the following mod to the code:

              } else if (s == 0) { /* Timeouts */
                       if (pvt->state == MBL_STATE_INIT2) { /* Some devices dont respond to AT+CIND? properly. RIM Blackberry 4 example */
                               pvt->state++;
                               rfcomm_write(pvt, "AT+CMER=3,0,0,1\r");
                       } else if (pvt->state == MBL_STATE_INIT3) { /* Some devices dont respond to AT+CMER=3,0,0,1 properly. VK 2020 for example */
                               pvt->state++;
                               rfcomm_write(pvt, "AT+CLIP=1\r");
                       } else if (pvt->state == MBL_STATE_INIT6) { /* Some devices dont respond to AT+CGMF */
                               pvt->state = MBL_STATE_PREIDLE;
                               pvt->has_sms=0;
                       } else if (pvt->state == MBL_STATE_PREIDLE) {

By: ciaranm (ciaranm) 2008-11-27 13:16:21.000-0600

Thanks ughnz and yep I know it has taken me ages to look at this again but... and thereĀ“s always a but...
Isnt that code already present in chan_mobile? Even with that code present the init timeout does not meet the condition as from my investigation the failure to respond to AT+CIND happens when we are at MBL_STATE_INIT1. Even if I do get the command AT+CMER=3,0,0,1 sent by either changing the code so this condition is met at MBL_STATE_INIT1 or issuing it manually at the command line in asterisk the initialisation may fail at a later stage or as has happened also the initialisation may suceed only for the bluetooth connection to be dropped when a call is received.
The only way I have got this to work is by repeatedly unloading and loading chan_mobile until the initialisation suceeds and if it does then the connection and calls behave perfectly.

By: David Shternberg (davidste) 2008-12-02 08:47:16.000-0600

i have the following system:

debian 4.05 (etch)
kernel 2.6.26-1-686
Asterisk SVN-trunk-r160208 (latest as far as of today)
Asterisk-Addons (latest svn from today also).
Blackberry 8330 and 8830 (CDMA)
CSR Chipset BT dongle (HCI 2.0)

i have managed to solve the BB init issue which was a serious pain using the following changes:

1. removed hcid daemon.
2. compiled bluez-4.21 from source (bluez.org) with enabling all the features in the configure process
3. configured Class: 0x4a2404 in the main.conf (no more hcid.conf)

before making those changes, i have realized that the problem is not in the chan_mobile code but in the bluez stack or the way it "talk" to the BB machine because after issuing the AT+CIND:? - the adapter would not have send this command to the Blackberry and of course the BB could not respond back. this was the main core of the problem which was solved using the above procedures.

everything is working perfect (5 phones concurrent), the only problem left to solve is the FAS.

By: Matthew Nicholson (mnicholson) 2008-12-17 18:12:54.000-0600

ciaranm,

Does davidste's solution work for you?

By: David Shternberg (davidste) 2008-12-17 18:32:57.000-0600

you can just say David's (ste is a shortcut for the last name) :)

By: Matthew Nicholson (mnicholson) 2009-01-14 18:18:38.000-0600

Ok, I finally was able to setup a test platform and I seem to be seeing this same problem with my blackberry 8830.  David's solution does not seem to be working for me with bluez-4.26.

By: Matthew Nicholson (mnicholson) 2009-01-14 18:43:47.000-0600

The problem was actually in my config file, I had the wrong address for my device.  It connects properly now.

By: Matthew Nicholson (mnicholson) 2009-01-14 19:06:52.000-0600

Looks like I can reproduce this after all.  I will investigate it further.

By: ciaranm (ciaranm) 2009-01-15 08:14:24.000-0600

I have not had much luck testing with bluez-4.26 as suggested. I had difficulty pairing my phone with my test box primarily because I dont have any app that will accept or respond to a pairing request from my phone (what did you use?). I think I managed to pair in the other direction i.e. from the test box to my phone using the test apps that were included with bluez-4.26 however with chan_mobile I could not get my phone to show up as a usable phone (back to shoing up as an unusable headset :( )
Would be most eager to see if you come up with anything and happy to test anything if it will help.

By: Matthew Nicholson (mnicholson) 2009-01-15 09:23:50.000-0600

I used the simple-agent script that comes with the bluez-4.6 source.  It took me some time to figure out that I even needed an agent to do pairing.

By: Matthew Nicholson (mnicholson) 2009-01-15 16:50:32.000-0600

Ok, after playing with this further, it appears that the blackberry will not respond to AT+CIND=? after AT+BRSF=4, but it does respond if you send AT+CMER=3,0,0,1 and then send AT+CIND=?.  I am also seeing the issue with the connection being dropped when a call is placed, although the blackberry does appear to be sending audio before dropping the connection.

By: Matthew Nicholson (mnicholson) 2009-01-15 17:28:06.000-0600

Good news!  I got this working by forcing AT+CMER=3,0,0,1 before AT+CLID=? and everthing including calls worked fine (audio sounded a bit strange though).  I am going to add an option (maybe something like blackberry=1) to force this behavior.

The HFP spec specifically states that the AT+CLID=? should come before the AT+CMER, so I am not sure why the blackberry behaves this way.  I am going to look into this some more to see if it has anything to do with the AT+BRSF value we are sending.

By: jongerenchaos (jongerenchaos) 2009-01-16 09:25:50.000-0600

Audio is not fine @ this moment with chan_mobile. But they working on it in the new patching module:(This interface is available for remote devices which can function in the Audio Gateway role of the HFP profiles.) I think the next version has more audio support and maybe that will increse the audio quality

mnicholson do you have also a delayed audio from asterisk to blackberry?

By: Matthew Nicholson (mnicholson) 2009-01-16 09:34:59.000-0600

I have not looked into the audio issues yet.  Something that looks odd to me is that the spec mandates cvsd audio but we are using slin I think.  Some googling reveals the the conversion is done automatically in the bluetooth hardware.  So I guess that is normal.

By: ciaranm (ciaranm) 2009-01-16 09:51:09.000-0600

I also have serious audio delay to the point where it is unusable and was hoping that bluez-4.26 might help but by the sounds of things it doesnt. One thing I will point out on the initialisation issue is that I had tried that AT+CMER=3,0,0,1 (sent using rfcomm write at the asterisk command line) and this caused the bt connection to be dropped as soon as I recieved a call (on a few occasions my blackberry actually rebooted!) but this could be because it was being sent at the wrong point in the initialisation i.e. while chan mobile was still waiting for the response to AT+CIND=?.

By: jongerenchaos (jongerenchaos) 2009-01-16 10:03:52.000-0600

Sorry but i mean the next version of bluez.

Check the new patches (from bluez developers):
http://markmail.org/message/lnnyoqviok6uwp7u#query:%22Leonid%20Movshovich%22+page:1+mid:z7gm6mpwcixiwrwz+state:results .

I think this can resolve some audioissue's or not?



By: Matthew Nicholson (mnicholson) 2009-01-16 10:13:49.000-0600

ciaranm and jongerenchaos,

I will test audio once I finish this patch.  Also I experience the same connection drop when I manually sent AT+CMER=3,0,0,1, because chan_mobile does not initialize properly, but once I patched it to send the AT+CMER= command before sending AT+CIND=? everything worked correctly (except when I placed a call from the mobile phone instead of from asterisk, which I believe is also a chan_mobile bug).  Hopefully I can get a patch out soon.

By: jongerenchaos (jongerenchaos) 2009-01-16 10:45:02.000-0600

Great! If there is a patch i will test them also, and i'll give you feedback if you like it.

With other phones (when you received or place a phonecall) this will some times disconnect the phone directly after call request.

I hope that if you create this patch that you also can test this audio delay, because this is a real problem also with other cellphones (for example nokia,motorola). I think the audiobuffer/delay is after a while bigger and bigger (sometimes 3 seconds).

By: Matthew Nicholson (mnicholson) 2009-01-16 12:08:35.000-0600

Ok.  I uploaded a patch that adds the 'blackberry' option which I have successfully tested.  Try it and let me know how it works for you.  It should be possible to automatically detect that the connected device is a blackberry, but I have not looked into it in depth yet.

By: jongerenchaos (jongerenchaos) 2009-01-18 13:34:09.000-0600

Patch works great! I test it too.

But the audio is a problem with some phones including with my blackberry perl (audio is delayed) on only one channel (from cellphone => asterisk).

I think there is a problem with encoding/decoding, because the other channel works great (from asterisk ==> cellphone).

hciconfig -a give the following info:
RX bytes:23488940 acl:582 sco:460177 events:737 errors:18
TX bytes:19772641 acl:185 sco:387799 commands:162 errors:200
(there are a lot of errors in the TX channel, maybe thats a problem incombination with chan_mobile??)

Do you have the same problem mnicholson ?



By: Leif Madsen (lmadsen) 2009-01-19 09:38:47.000-0600

If this patch resolves the issue posted here, I would encourage you to commit and close this issue out, and open a new one in re: to the audio.

This assumes the issues are not related to the same underlying problem, so I'll let mnicholson determine how he would like to move this forward.

Thanks!

By: Matthew Nicholson (mnicholson) 2009-01-21 10:58:44.000-0600

I am going to commit this.  Please open a new bug for the audio issues.

By: Digium Subversion (svnbot) 2009-01-21 12:09:26.000-0600

Repository: asterisk-addons
Revision: 725

U   trunk/channels/chan_mobile.c

------------------------------------------------------------------------
r725 | mnicholson | 2009-01-21 12:09:25 -0600 (Wed, 21 Jan 2009) | 7 lines

Add a 'blackberry' option for devices in chan_mobile to support blackberry
devices' non standard HFP behavior.

(closes issue ASTERISK-12938)
Reported by: ciaranm
Tested by: ciaranm, davidste, mnicholson, jongerenchaos

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=725

By: Digium Subversion (svnbot) 2009-01-21 12:23:51.000-0600

Repository: asterisk-addons
Revision: 728

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_mobile.c
U   branches/1.6.1/configs/mobile.conf.sample

------------------------------------------------------------------------
r728 | mnicholson | 2009-01-21 12:23:51 -0600 (Wed, 21 Jan 2009) | 18 lines

Merged revisions 725-726 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

........
 r725 | mnicholson | 2009-01-21 12:09:44 -0600 (Wed, 21 Jan 2009) | 7 lines
 
 Add a 'blackberry' option for devices in chan_mobile to support blackberry
 devices' non standard HFP behavior.
 
 (closes issue ASTERISK-12938)
 Reported by: ciaranm
 Tested by: ciaranm, davidste, mnicholson, jongerenchaos
........
 r726 | mnicholson | 2009-01-21 12:22:33 -0600 (Wed, 21 Jan 2009) | 2 lines
 
 Added an example for the new blackberry option in mobile.conf.sample
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=728

By: Digium Subversion (svnbot) 2009-01-21 12:24:28.000-0600

Repository: asterisk-addons
Revision: 729

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_mobile.c
U   branches/1.6.0/configs/mobile.conf.sample

------------------------------------------------------------------------
r729 | mnicholson | 2009-01-21 12:24:28 -0600 (Wed, 21 Jan 2009) | 18 lines

Merged revisions 725-726 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

........
 r725 | mnicholson | 2009-01-21 12:09:44 -0600 (Wed, 21 Jan 2009) | 7 lines
 
 Add a 'blackberry' option for devices in chan_mobile to support blackberry
 devices' non standard HFP behavior.
 
 (closes issue ASTERISK-12938)
 Reported by: ciaranm
 Tested by: ciaranm, davidste, mnicholson, jongerenchaos
........
 r726 | mnicholson | 2009-01-21 12:22:33 -0600 (Wed, 21 Jan 2009) | 2 lines
 
 Added an example for the new blackberry option in mobile.conf.sample
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=729