Anyone using MJ with own Asterisk server?
Moderators: Bill Smith, Pilot
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
Anyone using MJ with own Asterisk server?
I'm trying to configure MJ to work with my own asterisk server(PBX in a flash) in order to have more features, like caller id lookup, blocking, etc. .
I wouldn't believe it's as easy as extracting the sip credentials and using that as a trunk. There must be sth. like MJMD5 to work in between the PBX and the trunk, IMHO. Has anyone tried this? Did you have luck?
TIA!
I wouldn't believe it's as easy as extracting the sip credentials and using that as a trunk. There must be sth. like MJMD5 to work in between the PBX and the trunk, IMHO. Has anyone tried this? Did you have luck?
TIA!
I am currently running PIAF with MagicJack. You will need the mjproxy daemon running somewhere to do the nonce twirling.
Replace NXXNXXXXXX in the example below with your 10 digit phone number, MJ20CHARACTERPASSWD with your password, and MJPROXYIP with the IP address of the server running mjproxy. This might be your Asterisk box or an OpenWRT or DD-WRT router (I have had it working with both).
The remaining steps are:
1) Using FreePBX, Set up a trunk for your MJ.
Trunk Name: MagicJack
PEER Details:
username=ENXXNXXXXXX01
type=friend
secret=MJ20CHARACTERPASSWRD
qualify=2000
port=5070
nat=yes
insecure=very
host=MJPROXYIP
fromuser=ENXXNXXXXXX01
dtmfmode=inband
context=from-trunk
Register String
ENXXNXXXXXX01:MJ20CHARACTERPASSWRD@MJPROXYIP:5070/NXXNXXXXXX
2) Create an Outbound Route to call out on. I set my Dial Pattern so dialing 8 uses MagicJack, 9 uses GV, etc. Pick whatever you want here.
Outbound Route
Dial Patterns
8|.
Trunk Sequence
SIP/MagicJack
3) Configure Inbound Routing
Inbound Route
DID Number: NXXNXXXXXX
Hope this helps.
Replace NXXNXXXXXX in the example below with your 10 digit phone number, MJ20CHARACTERPASSWD with your password, and MJPROXYIP with the IP address of the server running mjproxy. This might be your Asterisk box or an OpenWRT or DD-WRT router (I have had it working with both).
The remaining steps are:
1) Using FreePBX, Set up a trunk for your MJ.
Trunk Name: MagicJack
PEER Details:
username=ENXXNXXXXXX01
type=friend
secret=MJ20CHARACTERPASSWRD
qualify=2000
port=5070
nat=yes
insecure=very
host=MJPROXYIP
fromuser=ENXXNXXXXXX01
dtmfmode=inband
context=from-trunk
Register String
ENXXNXXXXXX01:MJ20CHARACTERPASSWRD@MJPROXYIP:5070/NXXNXXXXXX
2) Create an Outbound Route to call out on. I set my Dial Pattern so dialing 8 uses MagicJack, 9 uses GV, etc. Pick whatever you want here.
Outbound Route
Dial Patterns
8|.
Trunk Sequence
SIP/MagicJack
3) Configure Inbound Routing
Inbound Route
DID Number: NXXNXXXXXX
Hope this helps.
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
-
oldtimercurt
- Dan isn't smart enough to hire me
- Posts: 281
- Joined: Sat Feb 07, 2009 11:45 am
- Location: Pensacola
I compiled the mjproxy source and am running it on the PIAF box. I did run it on a router at one time, but have since moved it to the same box that Asterisk is running on. The router is just redirecting the IAX, SIP, and RTP UDP ports to the PIAF box which allows me to use the public ip address of the router to accept SIP URI addresses to connect.cohomology wrote:Thank you jaybob413 for the instruction.
Seems your solution needs MJMD5 to run on a router. What if the PBX box is not behind a router? In fact, my scenario is that I'm running a hosted PBX virtual server.
So I gather my question boils down to: is there an MJMD5 port to i386 platform?
If you search for mjproxy, you should be able to download the source, compile it, and set up run scripts to start it on boot. They are different that the ones that are posted for OpenWRT/DD-WRT, but just use another one as an example, and modify it to do the start, stop, restart, etc. of mjproxy. Then in your MJ trunk, use the PIAF box as the host in the trunk setup and registration.
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
Gr8! This is exactly what I'm looking for!
jaybob413 wrote:I compiled the mjproxy source and am running it on the PIAF box. I did run it on a router at one time, but have since moved it to the same box that Asterisk is running on. The router is just redirecting the IAX, SIP, and RTP UDP ports to the PIAF box which allows me to use the public ip address of the router to accept SIP URI addresses to connect.cohomology wrote:Thank you jaybob413 for the instruction.
Seems your solution needs MJMD5 to run on a router. What if the PBX box is not behind a router? In fact, my scenario is that I'm running a hosted PBX virtual server.
So I gather my question boils down to: is there an MJMD5 port to i386 platform?
If you search for mjproxy, you should be able to download the source, compile it, and set up run scripts to start it on boot. They are different that the ones that are posted for OpenWRT/DD-WRT, but just use another one as an example, and modify it to do the start, stop, restart, etc. of mjproxy. Then in your MJ trunk, use the PIAF box as the host in the trunk setup and registration.
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
Can anyone direct me to the source code of MJMD5? I just cannnot find it anywhere. Maybe I'm too blind to see it ... ...
jaybob413 wrote:I compiled the mjproxy source and am running it on the PIAF box. I did run it on a router at one time, but have since moved it to the same box that Asterisk is running on. The router is just redirecting the IAX, SIP, and RTP UDP ports to the PIAF box which allows me to use the public ip address of the router to accept SIP URI addresses to connect.cohomology wrote:Thank you jaybob413 for the instruction.
Seems your solution needs MJMD5 to run on a router. What if the PBX box is not behind a router? In fact, my scenario is that I'm running a hosted PBX virtual server.
So I gather my question boils down to: is there an MJMD5 port to i386 platform?
If you search for mjproxy, you should be able to download the source, compile it, and set up run scripts to start it on boot. They are different that the ones that are posted for OpenWRT/DD-WRT, but just use another one as an example, and modify it to do the start, stop, restart, etc. of mjproxy. Then in your MJ trunk, use the PIAF box as the host in the trunk setup and registration.
Here is the post that I used for the source.cohomology wrote:Can anyone direct me to the source code of MJMD5? I just cannnot find it anywhere. Maybe I'm too blind to see it ... ...
http://www.phoneservicesupport.com/post42750.html#42750
Compile and put the binary in /usr/sbin, then create a run script in /etc/init.d like:
(Be sure to change where it has YOURCITY and YOURPASSWORD)
--- begin script ---
#!/bin/bash
#
# mjproxy This shell script takes care of starting and stopping
# standalone mjproxy.
#
# chkconfig: - 60 50
# description: mjproxy is a sip proxy, which is the program \
# that forwards incoming requests for MagicJack.
# processname: mjproxy
# Source function library.
. /etc/rc.d/init.d/functions
[ -x /usr/sbin/mjproxy ] || exit 0
RETVAL=0
prog="mjproxy"
mjproxy="/usr/sbin/mjproxy"
MJPROXYARGS="0.0.0.0 5070 proxy01.YOURCITY.talk4free.com 5070 YOURPASSWORD"
start() {
# Start daemons.
echo -n $"Starting $prog: "
daemon $mjproxy $MJPROXYARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
--- end script ---
Then add it to the startup list
chkconfig --add mjproxy
You will get a [Failed] on the start because the fork in mjproxy.c exits with a return value of 1, so it always says it fails. I did not bother with this, as the start, stop, restart, and status functions all do work. If you change the code at line 69 from exit(1) to exit(0) and recompile, start will always say [OK].
I did not spend any more time with that, as I was eager to move on to Google Voice integration.
And you may also want to change the useragent string that Asterisk sends to whatever the current MagicJack useragent string is. This can be done in /etc/asterisk/sip_general_custom.conf. Just add a line like:
useragent="MagicJack/1.80.484a (SJ Labs)"
That should do it. This setup has been working without fail or need to restart for days for both incoming and outgoing calls.
-
cohomology
- MagicJack Newbie
- Posts: 6
- Joined: Thu May 21, 2009 10:24 am
Thanks a lot! Will try it over the weekend and report back.
C
C
jaybob413 wrote:Here is the post that I used for the source.cohomology wrote:Can anyone direct me to the source code of MJMD5? I just cannnot find it anywhere. Maybe I'm too blind to see it ... ...
http://www.phoneservicesupport.com/post42750.html#42750
Compile and put the binary in /usr/sbin, then create a run script in /etc/init.d like:
(Be sure to change where it has YOURCITY and YOURPASSWORD)
--- begin script ---
#!/bin/bash
#
# mjproxy This shell script takes care of starting and stopping
# standalone mjproxy.
#
# chkconfig: - 60 50
# description: mjproxy is a sip proxy, which is the program \
# that forwards incoming requests for MagicJack.
# processname: mjproxy
# Source function library.
. /etc/rc.d/init.d/functions
[ -x /usr/sbin/mjproxy ] || exit 0
RETVAL=0
prog="mjproxy"
mjproxy="/usr/sbin/mjproxy"
MJPROXYARGS="0.0.0.0 5070 proxy01.YOURCITY.talk4free.com 5070 YOURPASSWORD"
start() {
# Start daemons.
echo -n $"Starting $prog: "
daemon $mjproxy $MJPROXYARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL
--- end script ---
Then add it to the startup list
chkconfig --add mjproxy
You will get a [Failed] on the start because the fork in mjproxy.c exits with a return value of 1, so it always says it fails. I did not bother with this, as the start, stop, restart, and status functions all do work. If you change the code at line 69 from exit(1) to exit(0) and recompile, start will always say [OK].
I did not spend any more time with that, as I was eager to move on to Google Voice integration.
And you may also want to change the useragent string that Asterisk sends to whatever the current MagicJack useragent string is. This can be done in /etc/asterisk/sip_general_custom.conf. Just add a line like:
useragent="MagicJack/1.80.484a (SJ Labs)"
That should do it. This setup has been working without fail or need to restart for days for both incoming and outgoing calls.
On the inbound routing for mine I had to use the ENXXNXXXXXX01 for the DID number - otherwise I got number is not in servicejaybob413 wrote:I am currently running PIAF with MagicJack. You will need the mjproxy daemon running somewhere to do the nonce twirling.
1) Using FreePBX, Set up a trunk for your MJ.
Trunk Name: MagicJack
PEER Details:
username=ENXXNXXXXXX01
type=friend
secret=MJ20CHARACTERPASSWRD
qualify=2000
port=5070
nat=yes
insecure=very
host=MJPROXYIP
fromuser=ENXXNXXXXXX01
dtmfmode=inband
context=from-trunk
Register String
ENXXNXXXXXX01:MJ20CHARACTERPASSWRD@MJPROXYIP:5070/NXXNXXXXXX
2) Create an Outbound Route to call out on. I set my Dial Pattern so dialing 8 uses MagicJack, 9 uses GV, etc. Pick whatever you want here.
Outbound Route
Dial Patterns
8|.
Trunk Sequence
SIP/MagicJack
3) Configure Inbound Routing
Inbound Route
DID Number: NXXNXXXXXX
Hope this helps.
you will either have to download and patch the source then compile or use the mjproxy program and run it on your server. I just patched my home box and it works great, will patch and change the work box from the mjproxy program tomorrow after my days off.XoDiViAoX wrote:Running Trixbox here
Best bet is to move to PBXIAF like I did from TrixBox - too many things you can not modify in TB that are easily available for PBXIAF users....
Take a look, you wont regret it
Myk
Need some help here please.
I have compiled the application on my trixbox server and put the startup script in the init.d directory as instructed.
All works fine accept when I try to telnet to port 5070 on the local host I get Unable to connect to remote host: Connection refused
What could be wrong?
This is my MJProxyargs
MJPROXYARGS="0.0.0.0 5070 proxy01.miami.talk4free.com 5070 PASSWORD"
I have compiled the application on my trixbox server and put the startup script in the init.d directory as instructed.
All works fine accept when I try to telnet to port 5070 on the local host I get Unable to connect to remote host: Connection refused
What could be wrong?
This is my MJProxyargs
MJPROXYARGS="0.0.0.0 5070 proxy01.miami.talk4free.com 5070 PASSWORD"
I think it is easier to just patch asterisk chan_sip.c than to use the proxy if your running asterisk. An advantage is that you don't need a seperate proxy for each MJ trunk.
See the following thread for instructions: http://www.phoneservicesupport.com/magi ... t7243.html
See the following thread for instructions: http://www.phoneservicesupport.com/magi ... t7243.html
Sad Times Ahead for this Obamanation !!!! Psalms 109:8
Magicjack plus write settings to my FreepBX server
has anyone find out how to get into the MJ Device to change the settings to the freepbx
-
crackerjack
- Dan Should Pay Me
- Posts: 784
- Joined: Fri Nov 16, 2007 9:32 pm
Re: Magicjack plus write settings to my FreepBX server
Yes, back in 2008pvsoares wrote:has anyone find out how to get into the MJ Device to change the settings to the freepbx
Good Luck
CrackerJack
MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"
CrackerJack
MagicJack Customer #73
MagicJack user since May 2007
MagicJack abuser since June 2007
"I gots mo' numbers than a Lotto machine!!!"