jump to navigation

Asterisk connection with Mobile phone using Chan_Mobile February 27, 2013

Posted by hasnain110 in Uncategorized.
trackback

Hey.. Below are the simple steps to configure chan-mobile for asterisk to use mobile phone as outgoing trunk
The system i have used is as follow

OS: OpenSuse 12.2
Asterisk Version:certified-asterisk-1.8.11-cert8
Mobile Phone: Nokia C1-01

Step 1:

Download and and unzip asterisk into a folder

Step 2:

(a) ./configure –disable-xmldoc
(b) make menuconig ( goto Addon and select chan_mobile and save) as shown  below

Asterisk Module and Build Option Selection
**************************************************

Press ‘h’ for help.

— extended —
[*] chan_mobile
[ ] chan_ooh323
[ ] format_mp3
[ ] res_config_mysql
— deprecated —
[ ] app_mysql
[ ] app_saycountpl
[ ] cdr_mysql

(c) run make
(d) run make install
(e) run make samples

Step 3:

Make sure you have bluez pakage install if not run yum install bluez*

Step 4:

In Step 4 we will try to make sure that the bluetooth device is working on the system run command

hcitool dev

linux-ensr:/ # hcitool dev
Devices:
hci0    90:00:4E:99:7F:60

Note: my bluetooth adapter MAC address is 90:00:4E:99:7F:60 and I will be using it later in below steps

You should get an output like given below where hci0 is the bluetooth interface if you have connected to bluetooth then you should see output like below

linux-ensr:/ # hcitool dev
Devices:
hci1    BB:4A:BB:33:31:51
hci0    90:00:4E:99:7F:60

Step 5:

Now in this step we need to configure asterisk to listen to the available bluetooth device that is hci0. Goto /etc/asterisk/ and edit file chan_mobile.conf and add the following line under [general]

[adapter]
id=internal ( ID could be anything you want)
address=90:00:4E:99:7F:60

In this step we have defined the available bluetooth adapter for Asterisk to listen if you have more then two adapter add them accordinly with different ID and ofcourse MAC address

Now Asterisk is ready to detect available bluetooth devices since we have configured it to use the bluetooth device

Step 6:

As in Step 5 we have already configured Asterisk to use the available bluetooth now its time to scan the available mobile devices using Asterisk console. We will goto asterisk console using command asterisk -rvvvvv

Once inside the console type the command

linux-ensr*CLI> mobile search

This command should give you result something like this

linux-ensr*CLI> mobile search
Address                         Name                         Usable     Type                    Port
00:25:47:36:D8:C0   Nokia 5130c-2         Yes           Phone                 13
78:2E:EF:9C:3D:5E  Red                            Yes            Phone                 13

So now we have two usable devices in this example we will be using mobile device name Red ( its a nokia c1-01 mobile phone)

Note the mac address and port of the phone we will be using it in the next step

Step 7:

Edit the same file chan_mobile.conf as done in Step 5 earlier. Now we will add the details of Mobile phone taken in step 6

Simplpy add the following lines at the end of the conf file

[red]
address=78:2E:EF:9C:3D:5E
port=13
context=incoming-mobile
adapter=internal ===> This Adapter ID internal we hav already defined in step 5
group=1

Save and exit from the file

Step 8:

Now its time to pair the mobile phone with the system bluetooth adapter

use avabile GUI for bluetooth pairing to connect the mobile phone with system as shown in image below

Step 9:

Once paried goto asterisk console by typing asterisk -rvvvv and then restart asterisk by typing core restart now

Step 10:

Go back to asterisk console again by typing asterisk -rvvv once its loaded asterisk will try to connect to already paired mobile devie

Asterisk will try to initiate the connect if prompted on mobile / system for pairing accept it. You should see something like this on console

— Bluetooth Device red has connected, initializing…
— Bluetooth Device red initialized and ready.

Once connected you can run the command to see the status

Run the command mobile show devices on asterisk console

linux-ensr*CLI> mobile show devices
ID              Address           Group Adapter         Connected State      SMS
red             78:2E:EF:9C:3D:5E 1     internal        Yes       No Service No

If Connected status is YES it means you are ready to goto the next step

Step 10:

We will create the Dial plan now to make call go throug the mobile. Goto /etc/asterisk/extensions.conf and add the following lines at the end of the configuration file

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

Herer red is the name of the mobile that I mentioned above in chan_mobile.conf in step 7

Save and exit

Step 11:

After making the dialplan now we have to create a sip account to make a test call designated for dial plan named [test]

Goto /etc/asterisk/sip.conf and edit it. Add the following lines at the end of the configurtion file

[test]
type=friend
host=dynamic
secret=test
dtmfmode=rfc2833
canreinvite=yes
nat=yes
qualify=yes
context=test

Save and exit

Step 12:

That is the final step simply use any sip dialer of your choice and use the credentials we defiened about in step 11 and make a test call

On asterisk console you should see call going to the mobile name (mine case its red )

== Using SIP RTP CoS mark 5
— Executing [03249255604@test:1] Dial(“SIP/test-00000000”, “Mobile/red/03249255604,45″) in new stack
— Called Mobile/red/03249255604

I think I pretty much tried to make it simple and easy. Asterisk Chan-Mobile does support more then two mobile phones that require some additional steps that I have not covered here, I run this knowledge sharing for free however small donations are always welcome.

If you are looking for more then one mobile solution please send me message or comment down to discuss

Do comment !

Comments»

1. cedarfinance.com - March 3, 2013

Asking questions are truly pleasant thing if you are
not understanding anything completely, however
this paragraph offers good understanding yet.

2. forex trading demo - March 3, 2013

That is a really good tip particularly to those fresh to the blogosphere.

Simple but very precise info… Appreciate your sharing this one.
A must read post!

3. cedarfinance - March 3, 2013

I’m gone to convey my little brother, that he should also visit this webpage on regular basis to take updated from newest information.

4. cedar finance phone number - March 3, 2013

Great work! That is the kind of info that should be shared around the net.
Disgrace on Google for not positioning this post higher!
Come on over and consult with my web site . Thanks =)

5. one touch binary options - March 3, 2013

Heya this is kinda of off topic but I was wondering if
blogs use WYSIWYG editors or if you have to manually
code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

6. forex trading Strategies - March 3, 2013

Superb blog! Do you have any tips for aspiring writers?
I’m hoping to start my own blog soon but I’m a little lost
on everything. Would you recommend starting with a free platform like WordPress or go for a paid option?
There are so many choices out there that I’m completely overwhelmed .. Any ideas? Thanks!

7. binary options calculator - March 3, 2013

Greetings from California! I’m bored to tears at work so I decided to check out your website on my iphone during lunch break. I really like the information you provide here and can’t wait to take
a look when I get home. I’m amazed at how quick your blog loaded on my mobile .. I’m not even using WIFI, just 3G .
. Anyhow, wonderful blog!

8. cedar 60 second trading - March 3, 2013

Highly energetic post, I enjoyed that a lot. Will there be
a part 2?

9. Binary options Affiliates - March 3, 2013

Hi everyone, it’s my first go to see at this web page, and paragraph is truly fruitful designed for me, keep up posting these types of articles.

10. Ralf - March 3, 2013

Hello there, I discovered your blog via Google at the same time as looking for a related matter, your site got here up, it seems great.
I’ve bookmarked it in my google bookmarks.
Hi there, simply become alert to your blog through Google, and located that it is truly informative. I am going to be careful for brussels. I will be grateful in case you continue this in future. Lots of people will likely be benefited out of your writing. Cheers!

11. one touch binary options - March 3, 2013

We stumbled over here from a different website and thought I should check things
out. I like what I see so now i’m following you. Look forward to exploring your web page again.

12. Frederic - March 3, 2013

If you want to take a good deal from this paragraph then you have to apply these strategies to your won webpage.

13. binary Options forex - March 3, 2013

Do you have any video of that? I’d want to find out some additional information.

hasnain110 - March 4, 2013

at the moment no !

14. strategies for trading binary options - March 3, 2013

I’m no longer sure where you’re getting your info, however good topic.
I must spend some time learning more or figuring out
more. Thank you for fantastic info I was on the lookout for this
info for my mission.

15. Odessa - March 7, 2013

I was able to find good information from your blog articles.

16. binary options demo - March 7, 2013

bookmarked!!, I like your site!

17. Mariam - March 23, 2013

Good article. I am experiencing some of these issues as well.
.

18. Gopi - April 28, 2013

Hi,

I am trying to pair my android mobile with asteriskNOW 3.0.0. Could you please me with a guide or links…I got lost in the google world :(.

19. hasnain110 - April 29, 2013

steps are pretty easy above already ..let me know the exact problem you are having .

20. Artur - May 21, 2013

I follow all the steps, and I can receive but not make calls through mobile phone. Every time I try an outbound call it just plays “the person at extension test is unavailable…”.

Any clue?

21. shabbir92 - July 21, 2013

hello dear hasnain
thankfull to you for this helpfuull blog
i am using my asterisk 1.8 from many months with 2 nokia C1-01 mobile for outbound calling everything is working good.
but some times during call mobile get disconnected from server and server retry to connect and shows device is in call untill i disconnect mobile call manually and then it connected again. it happens some times daily with both mobiles
please put some light on this thanks

hasnain110 - July 29, 2013

Hello ..I faced the same problem while using it for a while that machine often disconnect itself form the pairing. Till now Im not able to find the solution to fix it due to my busy schedule. Let me know if you have find the solution

shabbir - August 4, 2013

i have edited chan_mobile.c

oregional

/* check if a call is active */
if (pvt->hfp->cind_state[pvt->hfp->cind_map.call]) {
ast_verb(3, “Bluetooth Device %s has a call in progress – delaying connection.\n”, pvt->id);
goto e_return;
}

modified
/* check if a call is active */
if (pvt->hfp->cind_state[pvt->hfp->cind_map.call]) {
ast_verb(3, “Bluetooth Device %s has a call in progress – delaying connection.\n”, pvt->id);
ast_verb(3, “Bluetooth Device %s now we are disconnecting call because we need mobile.\n”, pvt->id);
/* goto e_return;*/
hfp_send_chup(pvt->hfp);
msg_queue_push(pvt, AT_OK, AT_CHUP);
pvt->needchup = 0;
}
i have recompiled and reinstalled
now after disconnection mobile it is not showing that mobile is in call
it hangsup call and connects again with in 30 seconds
i think u will find a better solution

hasnain110 - September 6, 2013

Not all mobile phones are compatible let me know what mobile are you trying to pair

22. tom - August 3, 2013

Have chan mobile working with Samsung s11 but when making calls the
Ringing tone is like you’re calling to mobile outside the country.
Can I change this
Tom

hasnain110 - September 6, 2013

Yes you should be able to but how need to do google

23. saik - September 3, 2013

i want to enable sms between asterisk sip users. i dont have much knowladge about it. i know the sms module sms manager type thing is present in asterisk how i can use it …..
plz if any one can help …

24. iqbal - October 28, 2013

hi there how cani set this up using more than one mobile phone and what is the limit? have you found a solution to the disconnect issue for phones which disconnect form the system? which type of phones are known to work most reliably?

25. Kailash Chandra - November 19, 2013

HI…

Dear Friend can you let me know how can i make a call to GSM/3G/CDMA using asterisk…

Like my numbet is +91986543287 and i want to call to +918800345673 how can i configure my server so “+91986543287” can make a call to “+918800345673”

Awaing for your reply…

hasnain110 - November 26, 2013

the entire topic is above for howto should be able to do if follow step by step

hasnain110 - December 23, 2013

sorry for replying late …was pretty occupied. Is your issues resolved ?

26. SALMAN AHMED - January 19, 2014

We have connected 4 mobile via Bluetooth for Outgoing calls, we need to make queue to Dial random mobile phones.

Please help us to describe Queue settings for Mobile Outgoing calls.

Thanks,
Salman

27. sharowar - February 10, 2014

Dear sir,
i am trying very much with ur tutarial but not done. i use ubuntu 12.4 and asterisk 1.8 when i menuselect i found chan mobile section XXX like this not scope to select please give me solve sir

hasnain110 - February 24, 2014

that is becuase you do not have necessary files required for compiling asteirsk with bluetooh. Please install all package apt-get install bluez* then reconfigure before you make manuselect.

28. Nakib - February 21, 2014

Asterisk getting answered signal immediately , when sending calls via Some Bluetooth Phone .

is there any work around ? or is there any asterisk command that will wait for at least 30 seconds and than declare that answered call as answer.

thanks.

hasnain110 - February 24, 2014

Please paste me here your dialplan

Nakib - February 25, 2014

Thank you for your reply.

[bt]

exten => _X.,1,Dial(Mobile/s0/${EXTEN},45)
exten => _X.,n,Hangup

29. totul - July 2, 2014

i need to add 5 mobile phone in asterisk with one bluetooth

30. Voice Stream - July 15, 2014

Dear Provider,
I’d like to use 20 mobile phone under one server to produce 20 concurrent calls at a time.
Please reply me at scworklog@gmail.com if you can make it.

hasnain110 - June 3, 2016

Am I too late to respond ?

Tharaka - July 30, 2023

is possible to connect over 8 mobile phones with chan mobile ?

31. Joeldine - October 13, 2014

hello,

First of all it is an excellent tutorial
I followed all the steps but my phone does not connect to the asterisk server. Plus I did not understand the step 8, it must pair with the server what GUI?
Thank you to answer me I ‘m blocked.

hasnain110 - February 20, 2015

Sorry for late reply ..just wondering if you have fixed the issue

32. OpenWrt 12.09 Aptitude Adjustment用Asterisk18のChan_Mobileを使う | あくまで暫定措置としてのブログ - November 2, 2014

[…] “Asterisk connection with Mobile phone using Chan_Mobile | Hasnain Ali Blog“ […]

33. Eric - March 8, 2015

Good post. I’ve been working on my project for over a year. Finding the right USB dongle was the hardest part. Now it conencts to my iPhone but keeps disconnecting. Any thoughts?

34. Burhan khan - May 30, 2015

In mobile search step..it give all bluetooth adapters are busy…plz give the solution for it..

35. vijaymuddu - July 26, 2015

Hi hasnainali its a excellent blog, you should be in the asterisk forums too

How can connect using Android mobile with kikkat or jellybean version -samsung,lg, etc.

Vijay Muddu
skype: vijaymuddu

hasnain110 - June 3, 2016

should be same procedure

36. Nishan - July 26, 2015

I want to add 8 or more bluetooth dongle.what will the configure.

hasnain110 - June 3, 2016

all info share here is free ..if you want further help you need to donate

37. OMAR - May 22, 2016

Salam 3lykom .. bro what if i have multiple phones how the dial-plan would be im trying without luck

i need if phone 1 is busy the call will go to phone 2 and so on

suhaibapp - June 3, 2016

كيفك عمر

ممكن التواصل على الايميل ؟
ssbbjo@hotmail.com

hasnain110 - June 3, 2016

all info share here is free ..if you want further help you need to donate

hasnain110 - June 3, 2016

all info share here is free ..if you want further help you need to donate

38. Rao Gobburu - March 7, 2017

Hi Hasnain,
Excellent article…. I have a quick question. I followed your article and now Asterisk on the Beaglebone has connected to the Mobile phone. I can see outgoing calls being setup as well as incoming calls to the mobile phone. But once the call is established I do not hear anything. There is only silence.
Is there something that has to be enabled for the audio?
Thank you.
Rao

39. Amila - November 14, 2017

Hello,
I have already connected one mobile and i need to configure more connection, please contact me.
thanks,
Amila.

Tharaka - July 30, 2023

Bluetooth pair image is shown ?

40. Ali Qayyum - August 28, 2018

Dear, Hasnain will please contact for developing it?

WhatsApp: +923204151698

41. Tharaka - July 30, 2023

there is no image how to pair bluetooth devices


Leave a reply to hasnain110 Cancel reply