Help dialing mobile using follow me

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
I am not sure if I am using the right approach, but the goal is to get my mobile to ring when a SIP extension is not registered. This is a SIP client on the same mobile phone that will leave the house and therefore not be registered.

I tried putting in 18005551212# in the follow me extension, and it did ring the mobile but no audio came through.

What would be the right way to accomplish this?

PIAF 1.7.5.5.4_x64 purple
 
Joined
Nov 20, 2010
Messages
157
Reaction score
0
That is the right way. Is there audio when you manually call the mobile from an Asterisk extension?
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
OK, got it to dial my mobile by defining it as a custom extension with the 'dial' field as local/800XXXXXXX@outbound-allroutes.

Now the trick is, how do I make it dial this number when one sip extension out of four in the ring group is not registered (indicating I am not at home, Bria SIP extension is in my pocket).
 

kh40s

Guru
Joined
Nov 21, 2010
Messages
86
Reaction score
0
OK, got it to dial my mobile by defining it as a custom extension with the 'dial' field as local/800XXXXXXX@outbound-allroutes.

Now the trick is, how do I make it dial this number when one sip extension out of four in the ring group is not registered (indicating I am not at home, Bria SIP extension is in my pocket).

I have a similar requirement. The way I do this is to have incoming calls rings the ring group, and then set a "Destination if no answer" to a Misc Destination that is setup to be my cellphone. This way, you don't really care if the sip client is registered or not. Not answering the calls by definition means you're not at home...

EDIT: Actually, on some incoming DIDs, I go one step further. The inbound route directs to a Time Condition. Depending on the time of day / day of week, this may cause the extensions in the ring group to ring (and then forward if no answer using the Destination if no answer mechanism), or alternatively just forward immediately to the cellphone
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
That would be an OK solution. However, callers would have to wait through some number of rings before 'no answer' was declared and the mobile extension rung.

I know Callcentric had a neat implementation where all incoming calls were forwarded when the SIP phone was not registered. Of course, CC is not that useable by itself as they don't support ring groups.

I would really like to find a way to ascertain the register status of the Android/Bria extension and use that as the criteria to ring the mobile or not.
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
OK, here is what I have so far.

I have the mobile configured as extension 10. I can dial the mobile from any of my LAN-registered SIP extensions, and it works fine.

However, when I try and use follow me, or ring group destination if no answer, the incoming call (VoIPo.com via PSTN) is redirected to the mobile, rings, and the outside caller recognizes the answer, but audio fails in both directions.

The mobile is a custom extension
Code:
[EMAIL="local/800555XXXX@outbound-allroutes"]local/800555XXXX@outbound-allroutes[/EMAIL]

The PIAF configuration seems to be pretty much working in other respects. I can make and receive calls from any extension using Callcentric/asterisk 1.8.1 x64.

Any idea how to troubleshoot this? I am so close to having Fixed Mobile Convergence nirvana :smile5:
 

kh40s

Guru
Joined
Nov 21, 2010
Messages
86
Reaction score
0
Here's how to do what you want. You need to define a custom destination in the freepbx gui. Go to Tools-->Custom Destination-->Add Custom Destination. In the field for Custom Destination, put

Code:
custom-ringgroup,s,1
And give it a description. Then edit /etc/asterisk/extensions_custom.conf and add the following custom dialplan

Code:
[custom-ringgroup]
exten => s,1,Macro(user-callerid,)
exten => s,n,Set(RingGroupMethod=ringall)
exten => s,n,Set(peerstatus=${SIPPEER(702,status)})
exten => s,n,GotoIf($[ $[ "${peerstatus}" = "UNREACHABLE" ] | $[ "${peerstatus}" = "UNKNOWN" ] ]?unreachable:reachable)
exten => s,n(reachable),Macro(dial,20,${DIAL_OPTIONS},701-702-703)
exten => s,n(unreachable),Macro(dial,20,${DIAL_OPTIONS},701-5555551212#-703)
exten => h,1,Macro(hangupcall,)
Make sure you change the extensions, the ring group list and the cellphone number appropriately. Extension 702 is the one running your softphone on your mobile. This code will check if the phone is reachable, and if so ring it. If not, it will dial out to the external number 5555551212. I've tested this, and it seems to work properly. The only caveat is that the extension definition in freepbx needs to have qualify=yes for this to work.

Now go to your inbound route, and set its destination to be a custom destination, and select "custom-ringgropup".
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
Thanks. There is so much to know about this that I have yet to learn. It appears you are addressing the issue of ringing the mobile when the mobile SIP phone is unregistered.

I also have an issue where an incoming call can't be forwarded to my mobile custom extension, but I can call it as an extension. Is the custom ring group meant to address this?

When I get home Sunday I'll try it out.
 

kh40s

Guru
Joined
Nov 21, 2010
Messages
86
Reaction score
0
Thanks. There is so much to know about this that I have yet to learn. It appears you are addressing the issue of ringing the mobile when the mobile SIP phone is unregistered.

I also have an issue where an incoming call can't be forwarded to my mobile custom extension, but I can call it as an extension. Is the custom ring group meant to address this?

When I get home Sunday I'll try it out.

Yes, this is to ring the mobile number when the SIP client is unregistered. It dynamically modifies the ring group based on whether or not the mobile SIP client is registered. If it is not registered, then the external mobile phone number is used in place of the extension in the ring group. You shouldn't need a mobile custom extension using this method.

Looking at this again, there is a more gui-friendly way to accomplish the same thing, allowing you to define and edit the extensions and mobile number in the Freepbx interface. Define two ring groups, say 600 and 601. In ring group 600, you would add the extensions to ring if the SIP client on the mobile phone is registered.

Code:
701
702
703
In ring group 601 you would add the extensions and the mobile phone number. This is the ring group that rings if the SIP client on the mobile phone is not registered.

Code:
701
5555551212#
703
Then you use the following dialplan instead of the one above

Code:
[custom-ringgroup]
exten => s,1,Set(peerstatus=${SIPPEER(702,status)})
exten => s,n,GotoIf($[ $[ "${peerstatus}" = "UNREACHABLE" ] | $[ "${peerstatus}" = "UNKNOWN" ] ]?unreachable:reachable)
exten => s,n(reachable),Goto(ext-group,600,1)
exten => s,n(unreachable),Goto(ext-group,601,1)
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
I got the script working as you wrote. Initially neglected to add the custom destination, but now, with the inbound route from Callcentric pointing to your custom destination, it will ring the mobile number along with the SIP phones on the LAN. I have checked the log and indeed it does correctly select the ring group based on the presence of ext 2 (my Android SIP client). It returns 'unknown' when it is not registered.

But no audio goes through in either direction to the mobile. So that is still a problem. Not sure why this fails, as I can call the mobile as an extension using a SIP extension on the LAN, just doesn't seem to work with an inbound call.

Any idea how to figure out what is going on here with the lack of audio to the mobile? I'm not sure this is the usual NAT one-way audio issue, as the PIAF box works in all other respects with LAN extensions. Also, the audio failure is in both directions to the mobile. Any possibility this could be related to the apparent call transfer issue with atom processors? Is the action I am trying to do a 'transfer'?
 
Last edited by a moderator:

jess101

Guru
Joined
Dec 20, 2009
Messages
11
Reaction score
0
Lifespeed, this is not related to your transfer problem. If you were to call in on one of your extensions from an outside phone (phone other than cell), and then transfer the call to your extension that your cell is tied to, it would work fine (assuming your call transfers are working).

I recently updated an older box that is running Asterisk 1.4.21.2 and was running some version of FreePBX prior to 2.6.0.3. I left Asterisk alone, and upgraded the FreePBX so that it is now 2.6.0.3. After that, all my Follow Me type of set ups that ring a cell phone BROKE! The cell rings, but no audio.

There is absolutely nothing different in my system outside this upgrade. Something in the FreePBX changes broke this feature. I can get it to work by adding "progressinband=yes" to my sip.custom.conf file, but then, some of my trunks will not play any progress tones after adding it, so it's not a real viable option. I did find over in the FreePBX forums, that this was a problem for several folks that has not received a fix. Too bad I didn't spot that before upgrading. I'm still playing around looking for a fix.
 

kh40s

Guru
Joined
Nov 21, 2010
Messages
86
Reaction score
0
Well, the solution I gave you here is a simple check that looks to see if your Android SIP client is online. If so, it directs the call to one ring group, and if not, to another.

There's no transfer involved here. If this doesn't work, then neither would a standard ring group that contains your cell phone likely work either. To be honest, I'm not sure why that would be the case. I can't replicate your problem, as the audio works fine when my cell phone is in the ring group.

What happens if you define a ring group with only your cellphone in it and direct an inbound route to this ring group? It may possibly be related to reinvite behaviour. You could try setting canreinvite=no on your trunk definition and do a tcpdump or sip and rtp debug in the cli interface to see where the packets are being sent.

EDIT: this could also be a NAT issue. You could try setting up an explicit rule on your firewall to forward incoming RTP from your trunk providers to your PBX. I am using an IAX trunk, which could be why it works for me and not for you, since IAX doesn't use out-of-band ports for the media stream.
 

jess101

Guru
Joined
Dec 20, 2009
Messages
11
Reaction score
0
So here's my kluge fix for this no audio problem for now. This is my office server, so it's very important to have the forward to a cell working correctly, as I don't like calls to go to voicemail. In order to get this working, I converted a spare DID I had with voip.ms to IAX2 from SIP. I changed the DID on the voip.ms website to IAX2, set up another voipms trunk as an IAX2, and just deactivated the SIP trunk. Using a prefix, I force the calls to my cell phone to use this IAX2 trunk.

Now, with everything else the same as it was before my FreePBX 2.6.0.3 upgrade, my follow me type calls to an external cell phone are back to working properly. This will work for now, until I figure out why it doesn't work as a SIP trunk. Like I said, putting progressinband=yes in my config file is not really a working solution, as it breaks the progress tones on some trunks.
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
Thanks Jess and kh40. I'm on vacation this week but will look at this Monday. canreinvite=yes currently so will check and report my findings.

KH40, your script works fine. The cell audio is clearly a separate issue, but only when redirecting an outside call.
 

kh40s

Guru
Joined
Nov 21, 2010
Messages
86
Reaction score
0
Thinking about the way the RTP streams would be handled here, I'm almost certain that your problem would be solved by setting up a rule on your firewall to forward 10000:20000 from your two trunk providers. In this situation, Asterisk is only acting as a relay. The SIP packets comes in from your provider, Asterisk relays it out via the trunk to your cellphone. Normally, the RTP stream can only be properly established through the firewall when Asterisk sends RTP outbound through the firewall. This sets up a mapping in the router's firewall table that allows the incoming RTP traffic to be subsequently passed through. In this particular case, the cellphone answers, sends RTP back, which gets blocked by the firewall. Ditto for the other side of the connection, the calling party. Since you have no internal phone trying to send out RTP, the mapping never gets established on your firewall.

You can try and test this by calling the ring group that has the cellphone in it directly from an internal extension. If this works, then the RTP firewall mappings are definitely the problem.
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
I can call the mobile (with two-way audio ) using it's extension, I'll confirm it also works when calling the mobile ring group.

Thanks everyone.
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
It' works!

KH40, you're the man!

I guess it was somehow obvious to you, but it sure wasn't clear to me that RTP audio was being blocked in just this particular incoming-rerouted-to-cellular situation.

So now that I have forwarded 10,000-20,000 UDP to my PIAF box it works! When my Bria for Android isn't registered, the call automatically goes to AT&T mobile. Fixed-mobile convergence nirvana is here! I can use my clear audio VoIP line at home, with calls automatically forwarded to my cell when I'm away. And thanks to your script, the PIAF box knows when I'm away without me having to fiddle with phone configuration every time I leave or arrive at my house.
 

Members online

Forum statistics

Threads
25,834
Messages
167,892
Members
19,259
Latest member
dancosge
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top