asterisk 502 Bad Gateway

magicJack Tips and Tricks

Moderators: Pilot, Bill Smith

Post Reply
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

asterisk 502 Bad Gateway

Post by plut0 »

I had magicjack working fine on asterisk up till a few days ago and didn't make any changes to break it. I can still receive phone calls fine but cannot make any calls. I am getting a "SIP/2.0 502 Bad Gateway" response from magicjack when attempting to make a phone call. Any ideas?
crackerjack
Dan Should Pay Me
Posts: 784
Joined: Fri Nov 16, 2007 9:32 pm

Re: asterisk 502 Bad Gateway

Post by crackerjack »

plut0 wrote:I had magicjack working fine on asterisk up till a few days ago and didn't make any changes to break it. I can still receive phone calls fine but cannot make any calls. I am getting a "SIP/2.0 502 Bad Gateway" response from magicjack when attempting to make a phone call. Any ideas?
Is it possible you have gone over the 'limit' for outbound calling minutes??

What does the cli show to sip show registry and sip show peers commands?

Good luck

Crackerjack
Good Luck

CrackerJack

MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

Registry shows registered and peer is OK. I don't believe that is the case. If I use the device with their software in windows I can make an outgoing call.

If I turn on sip debugging, when my machine sends out a SIP OPTIONS, magicjack responds with the bad gateway error.
crackerjack
Dan Should Pay Me
Posts: 784
Joined: Fri Nov 16, 2007 9:32 pm

Post by crackerjack »

plut0 wrote:Registry shows registered and peer is OK.
I think you're confused here...

What does the cli show to sip show registry and sip show peers commands?
please post here and sanitize as needed
Good Luck

CrackerJack

MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

Code: Select all

asterisk*CLI> sip show registry 
Host                           dnsmgr Username       Refresh State                Reg.Time                 
proxy01.newyork.talk4free.com: N      E**********01      105 Registered           Wed, 27 Jan 2010 08:29:14
1 SIP registrations.

asterisk*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status     
1000/1000                  192.168.0.8      D   N      5060     Unmonitored 
1001/1001                  (Unspecified)    D   N      5060     Unmonitored 
magicjack/E**********01    216.234.64.8         N      5070     OK (81 ms) 
3 sip peers [Monitored: 1 online, 0 offline Unmonitored: 2 online, 0 offline]
crackerjack
Dan Should Pay Me
Posts: 784
Joined: Fri Nov 16, 2007 9:32 pm

Post by crackerjack »

plut0 wrote:

Code: Select all

asterisk*CLI> sip show registry 
Host                           dnsmgr Username       Refresh State                Reg.Time                 
proxy01.newyork.talk4free.com: N      E**********01      105 Registered           Wed, 27 Jan 2010 08:29:14
1 SIP registrations.

asterisk*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status     
1000/1000                  192.168.0.8      D   N      5060     Unmonitored 
1001/1001                  (Unspecified)    D   N      5060     Unmonitored 
magicjack/E**********01    216.234.64.8         N      5070     OK (81 ms) 
3 sip peers [Monitored: 1 online, 0 offline Unmonitored: 2 online, 0 offline]
Looks good from here. Try a different proxy dc or baltimore
reboot your server.
Do you have an IP phone or just using softphone?
try using the most recent user-agent string.
Grasping at straws here.
What asterisk compilation are you using?
Good Luck

CrackerJack

MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

I'm using asterisk 1.6.2.0 on gentoo. The user agent string should be current, "MagicJack/1.90.521b (SJ Labs)". I did try restarting the asterisk service a few times. I tried hosts proxy01.newyork.talk4free.com and proxy01.boston.talk4free.com, I could try a few more I guess. I'm using a pap2t device connected to asterisk locally, I will try a soft phone also.

Like I said, I can receive calls fine just can't make any outbound calls.
VaHam
Dan Should Pay Me
Posts: 851
Joined: Wed Feb 13, 2008 8:02 pm

Post by VaHam »

plut0 wrote:I'm using asterisk 1.6.2.0 on gentoo. The user agent string should be current, "MagicJack/1.90.521b (SJ Labs)". I did try restarting the asterisk service a few times. I tried hosts proxy01.newyork.talk4free.com and proxy01.boston.talk4free.com, I could try a few more I guess. I'm using a pap2t device connected to asterisk locally, I will try a soft phone also.

Like I said, I can receive calls fine just can't make any outbound calls.
Are you using MJMDM5 proxy or a modified chan_sip.so?
Sad Times Ahead for this Obamanation !!!! Psalms 109:8
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

I'm using the modified chan_sip.so patch from this forum.
patspats
MagicJack Newbie
Posts: 2
Joined: Mon Jan 12, 2009 10:47 pm

Post by patspats »

I have the same problem. I am using MJMD5 in windows and connect to it via asterisk. It worked for 6 months without any problem. Now I cannot may outgoing calls. Incoming calls are still fine.
JRoque
MagicJack Newbie
Posts: 8
Joined: Wed Jul 29, 2009 1:38 pm

Post by JRoque »

Same here. I'm on MJMD5 proxy. This started happening on both by MJ accounts over the weekend, probably Monday morning. Even the one I've had for about 2 years running directly from Asterisk (no proxy) stopped working.

I plugged one of the devices back in and re-registered as prompted. Dumped it, same password and account but still wont work.

I had to resort to plug in the dongle and routing through an ATA (yuk). The MJ guys are probably reading this and laughing. Too bad because it worked very well for me. I bought 5 years of service as a way to support them but it won't do if I have to use an ATA. With Google Voice SIP looming, they should look to support us a bit better. Maybe a bit more money for the accounts, maybe a minimum number of years, etc. They're probably using Asterisk for their own system so it'd be only fair they support us.

Thanks,
JR
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

Funny you should mention that JRoque...I've admined asterisk as a PBX at three different companies so I'm pretty familiar with it. The template magicjack uses for voicemail via email leads me to believe they are using asterisk as their PBX. Also, if you listen to their voicemail system, the voice is Allison Smith, she works for digium, the creators of Asterisk.
JRoque
MagicJack Newbie
Posts: 8
Joined: Wed Jul 29, 2009 1:38 pm

Post by JRoque »

Yep, that's Allison. I didn't know if she had licensed her voice to them separately but it seems they are indeed using Asterisk. I tried an IAX2 connection early on but they have that blocked. Let's hope they change their stance on supporting outside Asterisk users.

In the meantime, I'm stuck with a stupid Win32 box, their software and an ATA.

Thanks,
JR
crackerjack
Dan Should Pay Me
Posts: 784
Joined: Fri Nov 16, 2007 9:32 pm

Post by crackerjack »

plut0 wrote:Funny you should mention that JRoque...I've admined asterisk as a PBX at three different companies so I'm pretty familiar with it. The template magicjack uses for voicemail via email leads me to believe they are using asterisk as their PBX. Also, if you listen to their voicemail system, the voice is Allison Smith, she works for digium, the creators of Asterisk.
They are using asterisk for the voicemail<->email part of the system. I thought that has always been obvious. They are using some much heavier iron for their voice backend. Check the agent strings on the invites...


BTW, oldy, moldy MJ sip credentials still working w/o MJMDS, just checked


Later

Crackerjack
Good Luck

CrackerJack

MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

So whats different about your setup than mine?
marius
MagicJack Newbie
Posts: 1
Joined: Thu Jan 28, 2010 7:55 am

Post by marius »

I had the same problem with my asterisk and I managed to fix it. In my case the solution was to set sendrpid=no in sip.conf for the magicjack account.

Also, I was setting the P-Asserted-Identity sip header in my dialplan, which I had to disable.
patspats
MagicJack Newbie
Posts: 2
Joined: Mon Jan 12, 2009 10:47 pm

Post by patspats »

Thank you. "sendrpid=no" does work.
fala
magicJack Apprentice
Posts: 20
Joined: Sat Mar 28, 2009 7:37 pm

Post by fala »

marius wrote:I had the same problem with my asterisk and I managed to fix it. In my case the solution was to set sendrpid=no in sip.conf for the magicjack account.

Also, I was setting the P-Asserted-Identity sip header in my dialplan, which I had to disable.
Great!!! "sendrpid=no" included in my Magic Jack PEER Details did the trick and now I can resume making outgoing calls through my magic Jack trunk from my Asterisk server. Thanks a lot.

BTW, what change did Magic Jack implement to require this line in your trunk detail?
JRoque
MagicJack Newbie
Posts: 8
Joined: Wed Jul 29, 2009 1:38 pm

Post by JRoque »

Fixed it for me too, thanks much!!

JR
dan
Dan isn't smart enough to hire me
Posts: 113
Joined: Mon Nov 12, 2007 6:57 pm
Location: Denver

Post by dan »

little off subject but I used to use a trunk with MJ via asterisk have not for almost a year now. are you guys authenticating via the trunk configs? I know there was some program needed where you had to use a windows PC running a proxy script something called MJM5 I think


If registration can be done via Asterisk alone would someone be kind enough to post the trunk configs and string
JRoque
MagicJack Newbie
Posts: 8
Joined: Wed Jul 29, 2009 1:38 pm

Post by JRoque »

I use both. On an older MJ account, I can authenticate directly using the trunk's parm. On a newer (Jun/2009) account, I had to use mjmd5 proxy which I compiled to run on CentOS and runs as a service.

JR
plut0
magicJack Apprentice
Posts: 15
Joined: Tue Jan 26, 2010 6:59 pm

Post by plut0 »

You need to patch asterisk chan_sip.so to register directly. mjmd5 proxy is not needed.
dan
Dan isn't smart enough to hire me
Posts: 113
Joined: Mon Nov 12, 2007 6:57 pm
Location: Denver

Post by dan »

Plut0

can you explain more? what do you mean by patch?
dan
Dan isn't smart enough to hire me
Posts: 113
Joined: Mon Nov 12, 2007 6:57 pm
Location: Denver

Post by dan »

actually never mind I pulled a rookie move here. I found what I needed i will give it a try..

thanks guys
Ggilbert
MagicJack Newbie
Posts: 1
Joined: Fri Oct 25, 2024 8:13 am

Re: asterisk 502 Bad Gateway

Post by Ggilbert »

Check for recent updates or changes on MagicJack's end; a SIP 502 error often signals a server issue or temporary outage.
Post Reply