Asterisk Entry: asterisk + fritz Date: Fri Feb 6 22:55:49 CET 2009 So.. I'd like to call the house phone from my laptop over the internet. How to proceed? Installing asterisk on giebrok (static IP). Installing ekiga on one. http://www.juerging.net/index.html?http://www.juerging.net/projekte/Fritzbox-Asterisk/ Entry: Briding Asterisk and Skype Date: Sun Feb 6 10:46:46 EST 2011 There seem to be quite some options, see list at [5]. I'm following up on skypopen[1] which gives me the best subjective impression. It says to use the Skype static linux build 2.0.72, but I can only find the 2.1.0.81 version on the Skype website. Skype itself seems to be not cooperating in providing old versions[3]. Looking a bit further I found this [2] but no link. Some checksums found here[4]. [http://download.skype.com/linux/skype_static-2.0.0.72.tar.bz2] md5=cfaa796ef55e3f858a09bbe096eded5a sha256=2f37963e8f19c0ec5efd8631abe9633b6551f09dee024460c40fad10728bc580 Looking further on the MD5 I finally found this[6], which unfortunately is not the same MD5: ff41dd31906484863884ee0a7da441c1 skype_static-2.0.0.72-oss.tar.bz2 Giving up.. Seems to much trouble. I wonder if there is a way to do this externally. Is there a free or cheap skype to SIP bridge that avoids local software hacks? [1] http://wiki.freeswitch.org/wiki/Skypiax [2] http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg164742.html [3] http://forum.skype.com/index.php?showtopic=90977&st=20&s=d748e42f40f8a0f49f8f5d4d71b5e666 [4] http://terkos.googlecode.com/svn-history/r1232/trunk/oe/openembedded/conf/checksums.ini [5] http://www.voip-info.org/wiki/view/Skype+Gateways [6] http://www.mediafire.com/?2ydhmj4yo3i Entry: Asterisk behind firewall Date: Sun Feb 6 16:08:18 EST 2011 Asterisk doesn't support STUN, so if the SIP registrar doesn't implement transparent firewall piercing tricks it seems calls don't get through. I.e. I was able to get my @ekiga.net account to register, but the voice channel isn't setup properly. Looks like I have several options: - Figure out how to configure the firewall to forward all ports to main host. - Remove firewal, use zzz-like configuration with firewall on zoo. - Run asterisk on vserver on giebrok. By far the simplest solution seems to be to figure out (once and for all) how to forward all ports on the router to zoo. Entry: pbxes.org Date: Thu Feb 17 12:51:03 EST 2011 Is this actually useful? EDIT: yes, very! I use it fro ipkall.com inbound for asterisk on internal network, i.e. not at public IP. Asterisk can just register SIP on pbxes.org Entry: Asterisk behind firewall Date: Sat Feb 19 12:24:23 EST 2011 So, config: externip= localnet=192.168.6.0/255.255.255.0 nat=yes The problem is that I'm trying to perform a call from within my network. To any host this looks like the router's IP address. However, if asterisk is trying to send to this address from the _inside_ of the firewall it won't work! Entry: Up 1 hour and already got SIP scanned Date: Sat Feb 19 12:36:05 EST 2011 The host below is scanning all extensions up to 9999. Looks like the ACL is configured correctly so this is not allowed. zoo:/var/log/asterisk# cat messages |grep '"11"' [Feb 19 12:24:26] NOTICE[21123] chan_sip.c: Registration from '"11"' failed for '77.242.169.94' - Device does not match ACL Entry: SIPbroker Date: Sat Feb 19 14:22:22 EST 2011 To test an inbound call, use SIPbroker. After registration (user = ext@domain) you can use the following to setup a call: http://www.sipbroker.com/sipbroker/action/callOut I.e. *850301 is echotest from http://www.ideasip.com/support/numbers.php For more numbers see http://faq.sipbroker.com/tiki-index.php?page=Phone%20Numbers Entry: Router public IP (i.e. for asterisk) Date: Sat Feb 19 14:48:32 EST 2011 Place this script in /www/cgi-bin/public_ip: ps #!/bin/sh ifconfig eth0.1 | grep 'inet addr' | sed 's/:/ /' | awk '{print $3}' Then the contents is accessable as wget http://fred/cgi-bin/public_ip -q -O - Entry: Sipdroid over VPN Date: Thu Oct 6 11:53:03 EDT 2011 Sipdroid uses IP from ppp0. How to fix? This thread[1] has an .apk with a patched 2.0.1 that allows you to pick the interface, i.e. "tap0" in my case for OpenVPN. REGISTER sip:zoo SIP/2.0 Via: SIP/2.0/UDP 10.241.229.6:59737;rport;branch=z9hG4bK17601 Max-Forwards: 70 To: From: ;tag=z9hG4bK23862409 Call-ID: 138760461580@10.241.229.6 CSeq: 1 REGISTER Contact: Expires: 3600 User-Agent: Sipdroid/2.3 beta/DROID2 GLOBAL Content-Length: 0 Receiving calls still doesn't work. Will have to try later... Routing calls over the asterisk box seems to work, though gives dropouts. Might be connection speed also. [1] http://code.google.com/p/sipdroid/issues/detail?id=368 Entry: Discovering at Date: Wed Nov 30 21:00:38 EST 2011 echo ring | at 21:03 Where "ring" is the command to run. To display all queued events use atq I use this to ring my phone using asterisk call files[1] placed in /var/spool/asterisk/outgoing [1] http://zwizwa.be/darcs/pool/bin/dial_hello Entry: Fritz!Box FON & FXO Date: Mon Mar 12 22:24:42 CET 2012 Is it possible to use the Fritz!Box FON 5124 FXO as a trunk line for asterisk? It doesn't look like this is supported. Found something about a different Fritz device 7270[1][2] that has a SIP server built in, but can't seem to find this on mine[3]. Bummer.. FXS works fine though. [1] http://www.3cx.com/forums/fritzbox-fon-wlan-7270-as-outbound-gateway-15151.html [2] ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7270/firmware/english/info.txt [3] ftp://ftp.avm.de/fritz.box/fritzbox.fon_5124/firmware/english/annex_a/info.txt Entry: Asterisk & RTP ports Date: Tue Mar 13 16:11:04 CET 2012 in asterisk/rtp.conf: [general] rtpstart=8000 rtpend=9000 however, asterisk still sends invite for port 12726. Questions: - where does 12726 come from? - how does the remote party pick its ports? do we have anything to do with that? I've upped the window in the firewall, second try uses port 15628 which now works. STUPID! rtf.conf did not have the right permissions (and asterisk did not complain about it!) Entry: Email notifications for missed calls in Asterisk Date: Wed Apr 18 15:29:28 EDT 2012 Cached from [1]. Author: Matt Schmandt A feature I have wanted for a long time is to get emails about missed calls. I have a Blackberry and knowing that people are calling and hanging up before leaving a vm is very useful when I am out in the field. I wrote a small shell script to add this functionality to Asterisk. I place the script in the h extension of the stdexten marco. The h extension triggers once a call is hung up from that context. The first and only priority for the h extension is a System() call. It calls this shell script and passes many parameters to it. The first parameter is the email address to send the email to. To make this work for the marco, I adjust the macro to have a third parameter which is email address. I would like to pull the email address from that extensions vm but that function does not exist and I could not figure out how to add that function in the C source code. If anyone knows a better way, please let me know. The script requires you have the mailx package installed. Download the script[2] Rename the file processCallEmail.sh. mv processCallEmail.txt processCallEmail.sh Put it in the /var/lib/asterisk/agi-bin directory. mv processCallEmail.sh /var/lib/asterisk/agi-bin/" Make sure the asterisk user has execute permissions on the script. chmod 755 /var/lib/asterisk/agi-bin/processCallEmail.sh Add one line of documentation to macro-stdexten context on the line after ${ARG2}. ; ${ARG3} - email address to send emails about missed calls to Add the h extension line to the macro-stdexten context. exten => h,1,System(processCallEmail.sh "${ARG3}" "${CALLERID(num)}" "${CALLERID(name) }" "${DIALSTATUS}" "${VMSTATUS}") Alter the line that calls the macro to include an email address. exten => 500,1,Macro(stdexten,500,SIP/${EXTEN},abc@test.com) Here is an example of an updated stdexten macro. [macro-stdexten]; ; ; Standard extension macro: ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well ; ${ARG2} - Device(s) to ring ; ${ARG3} - email address to send emails about missed calls to ; exten => s,1,AGI(ldaplookupphone2.agi) exten => s,n,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain exten => h,1,System(processCallEmail.sh "${ARG3}" "${CALLERID(num)}" "${CALLERID(name) }" "${DIALSTATUS}" "${VMSTATUS}") Script: #!/bin/sh #Used for email alerting of incoming calls #Written by Matt Schmandt #version .1 #License: GPL #$1 email address #$2 callerid num #$3 callerid name #$4 dial status #$5 vm status #Store command line args in nice variables EMAIL=$1 CALLERIDNUM=$2 CALLERIDNAME=$3 DIALSTATUS=$4 VMSTATUS=$5 LOGFILE="/var/log/processCallEmail.log" MAILCMD="mailx -s" SUBJECT="call" SENDMAIL=1 #Set to 1 if you want it to email the alert. 0 is useful for debugging. DEBUG=0 #Set to 0 for standard operation. 1 will log inputs and mail commands for debugging. #log mail command if [ $DEBUG -eq 1 ]; then echo $1 $2 \"${3}\" $4 $5 >> $LOGFILE fi #Check we have an email address if not quit if [ "$EMAIL" == "" ]; then exit 0 fi #check for call canceled. ex. 1 ring then hangup if [ $DIALSTATUS == "CANCEL" ]; then BODY="${CALLERIDNAME} (${CALLERIDNUM}) hung up quickly." fi #check for answered call. ex. someone picks up if [ $DIALSTATUS == "ANSWER" ]; then # BODY="$CALLERIDNAME ($CALLERIDNUM) was answered by $PEERNAME." # Use the above line if you want alerts about answered calls. # At work this is not useful but at home it is. :) exit 0 fi #check for unanswered call. ex. phone rang and no one picked up if [ $DIALSTATUS == "NOANSWER" ]; then BODY="${CALLERIDNAME} (${CALLERIDNUM}) hung up." #check for hangup in vm menu. ex call went to vm and user hung up if [ $VMSTATUS == "USEREXIT" ]; then BODY="$CALLERIDNAME ($CALLERIDNUM) hung up on vm." fi #check for hangup in vm menu. ex call went to vm and user hung up if [ $VMSTATUS == "FAILED" ]; then BODY="$CALLERIDNAME ($CALLERIDNUM) hung up on vm." fi #if they left a vm we already would get an email. Don't need a 2nd if [ $VMSTATUS == "SUCCESS" ]; then exit 0 fi fi #log mail command if [ $DEBUG -eq 1 ]; then echo $BODY $MAILCMD $SUBJECT $EMAIL >> $LOGFILE fi #send email if [ $SENDMAIL -eq 1 ]; then `echo $BODY | $MAILCMD $SUBJECT $EMAIL` fi exit 0 [1] http://www.theschmandts.org/blog/email-notifications-for-missed-calls-in-asterisk [2] http://www.theschmandts.org/blog/wp-content/uploads/2007/05/processcallemail.txt Entry: SIP + in-band DTMF? Date: Sun Aug 26 21:12:56 BST 2012 Does incoming SIP give DTMF properly? With DISA on outbound SIP it seems they are ignored when calling a cell phone. Channel: SIP// Application: DISA Data: no-password,internal Might be a codec issue. I found that only alaw/ulaw can properly transport in-band DTMF, so using: disallow = all allow = alaw allow = ulaw So I changed that and set dtmfmode=inband, now I get double digits, sometimes, sometimes not. Probably this is a provider issue. Don't have anything else.. Maybe this is something fixed in a more recent version? Asterisk 1.8.8.2~dfsg-1, Copyright (C) 1999 - 2011 Digium, Inc. and others. Asterisk 1.8.13.0~dfsg-1+b1, Copyright (C) 1999 - 2012 Digium, Inc. and others. Doesn't change anything, still double digits. relaxdtmf=yes doesn't do anything either.. I guess this isn't going to work without a different provider or patches to asterisk .c so let's forget it. Also, using this trick to circumvent cell phone costs still needs 2x the Betamax cost to do the call, though one of them might be free. Entry: Configuring SPA3102 Date: Thu Sep 27 17:37:24 EDT 2012 Plugged it in and everything seemed to work, including voice mail and stutter tone. Configured SIP access for both the line and phone ports. I can call the line port using Asterisk. I can't call out to the phone port using Asterisk. After setting up SIP, the voice mail (*99) is no longer accessible. My guess is that since there was no SIP registered, it automatically plugged everything through. Next: get another splitter to allow for parallel development. Entry: asterisk cdr_csv.so Date: Mon Nov 26 08:39:54 EST 2012 Looks like this behavior is optional: CLI> module load cdr_csv.so Entry: Asterisk under attack Date: Fri Mar 22 09:40:38 EDT 2013 Currently being SIP-scanned fairly aggressively, effectively DOSsed. How to handle this? Probably best at the firewall level. I need a chain that does IP filtering such that - It doesn log: logging by itself already freezes the box - hosts can be handled on the fly Entry: ipkall.com + pbxes.org Date: Thu May 2 11:24:16 EDT 2013 I've disabled direct SIP in at home to avoid the countless SIP attacks. It seems not straightforward to deal with this in asterisk, as it needs some kind of firewall <-> asterisk integration, so now I'm routing everything through pbxes.org ipkall, route PSTN number to -@pbxes.org /etc/asterisk/sip.conf :: register:-:@pbxes.org Next thing to try would be to connect directly to google talk[1], enabling google voice -> internal asterisk routing. This to avoid the harsh ipkall removal approach. [1] https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google Entry: STUN Date: Sun Aug 18 23:42:45 EDT 2013 I finally get it. You probably need a STUN server when placing a sip call if *you* are behind a masquerading firewall. The reason is that the SIP headers contain *your* IP, not the IP of the masquerading server. A SIP client uses a STUN server to obtain its masquerading / outgoing IP, so it can pass the address in SIP headers to other parties. CSipSimple uses stun.counterpath.com Entry: The 's' extension Date: Mon Aug 19 14:00:19 EDT 2013 From [1] The "s" extension is used when there is no known called number in the context used. ... Incoming calls are always placed in a context in the dialplan, either one you specify in the channel configuration file, or the default context. If no other match exist for the call within the context, the s extension is activated. From [2] it seems that an extension can be provided in a register clause: register => user[:secret[:authuser]]@host[:port][/extension] [1] http://www.voip-info.org/wiki/view/Asterisk+s+extension [2] http://www.voip-info.org/wiki/view/Asterisk+SIP+register Entry: Some numbers not working on betamax? Date: Mon Aug 19 18:53:09 EDT 2013 Got two new ipkall numbers in 253 and 425 area codes, and they give the trace below. Work fine using regular phone. znork*CLI> core set verbose 3 Verbosity was 1 and is now 3 == Using SIP RTP CoS mark 5 -- Executing [94@internal:1] Dial("SIP/16-00000063", "SIP/outbound/14256063067") in new stack == Using SIP RTP CoS mark 5 -- Called SIP/outbound/14256063067 -- Got SIP response 500 "Internal server error" back from 77.72.169.129:5060 -- SIP/outbound-00000064 is circuit-busy == Everyone is busy/congested at this time (1:0/1/0) -- Executing [94@internal:2] Hangup("SIP/16-00000063", "") in new stack == Spawn extension (internal, 94, 2) exited non-zero on 'SIP/16-00000063' Looks like a betamax problem. Here's something reported from voipraider.com : http://forums.asterisk.org/viewtopic.php?p=62045 Entry: SIP proxy instead of PBX? Date: Wed Aug 21 16:24:03 EDT 2013 Makes sense. Using asterisk, I can't place user@domain SIP calls. [1] http://www.opentelecoms.org/use-a-sip-proxy-instead-of-asterisk Entry: Outbound Belgium Date: Sun Aug 25 15:48:48 EDT 2013 On [1] the best Betamax prices for Belgian portables are: - http://freevoipdeal.com - http://voipyo.com Both include free landline calls and free US calls. Though this doesn't seem to be accurate any more. VoipYo doesn't offer freecalls. Rates for Belgium are 0.5, while US is 0. Let's make a scraper for these. Shouldn't be too hard.. [1] http://backsla.sh/betamax Entry: AstDB Date: Wed Oct 1 17:38:13 CEST 2014 # sqlite2 db content of cdr_csv /var/lib/asterisk/sqlite.db # sqlite3 db with astdb : DB() in dialplan /var/lib/asterisk/astdb.sqlite3 # old berkely db /var/lib/asterisk/astdb To use in dialplan rules: exten => 456,1,Set(DB(test/count)=1) exten => 456,n,Set(COUNT=${DB(test/count)}) exten => 456,n,SayNumber(${COUNT}) This should be enough to do the following: - map extensions to real phone numbers - map caller to thunk to use (which has external caller id) Keys are / At the prompt: database get database put database del # For each internal phone, set a separate outgoing thunk. database put outbound 11 outbound_tom database put outbound 12 outbound_tom database put outbound 13 outbound_mel database put outbound 14 outbound_be database put outbound 15 outbound_be database put outbound 17 outbound_tom database put outbound 18 outbound_mel database put outbound 19 outbound_tom # Shortcuts as well database put shortcut xx yyyyyyyyyyyy Entry: Per country check Date: Wed Oct 1 20:12:27 CEST 2014 No longer necessary, so leaving it here for reference: ;; Extra password except USA(1) + Belgium(32) ;; international format: 5 or more digits exten => _1XXXX.,1,Dial(SIP/outbound/${EXTEN}) exten => _1XXXX.,n,Hangup() ;; exten => _32XXX.,1,Dial(SIP/outbound/${EXTEN}) exten => _32XXX.,n,Hangup() ;; exten => _XXXXX.,1,Authenticate(1234) exten => _XXXXX.,n,Dial(SIP/outbound/${EXTEN}) exten => _XXXXX.,n,Hangup() Entry: ipkall no longer used Date: Wed Oct 1 20:21:18 CEST 2014 ;; Ipkall either connects to zwizwa-102@pbxes.org or zwizwa-102@prgmr.zwizwa.be exten => zwizwa-102,1,Dial(SIP/18&SIP/17) exten => zwizwa-102,n,Hangup() Entry: Broken DISA Date: Wed Oct 1 20:26:53 CEST 2014 Not sure why this broke. ;; This no longer works: ;exten => pbx,1,Answer() ;exten => pbx,n,Goto(pbx_${CALLERID(num)},1) ;exten => pbx_6165976468,1,DISA(no-password,internal) ;exten => pbx_5172582781,1,DISA(no-password,internal) ;; This works exten => pbx,1,Authenticate(3405) exten => pbx,2,Background(pls-wait-connect-call) exten => pbx,3,DISA(no-password,internal) ;; Using just my inbound number ;; Neither beeps nor dtmf is getting through consistently.. ;; I had 8 -> disa exten => tom,1,Answer() exten => tom,n,Playtones(420) exten => tom,n,WaitExten(3) exten => tom,n,StopPlaytones() exten => tom,n,Dial(SIP/12) exten => tom,n,VoiceMail(11@vm) Entry: Setting up calls Date: Sat Oct 25 10:59:32 EDT 2014 copy this file into /var/spool/asterisk/outgoing/ Channel: SIP/17 Application: Dial Data: SIP/18 Note that SIP/17 doesn't hear any dial tone. For called party the caller ID is not set properly. Entry: Setting caller ID from database Date: Sat Oct 25 12:43:13 EDT 2014 exten => tom,n,Set(CID=${CALLERID(num)}) exten => tom,n,Set(NAME_CID=${CALLERID(name)}) exten => tom,n,Set(NAME_DB=${DB(callerid/${CID})}) exten => tom,n,Set(CALLERID(name)=${IF(${ISNULL(${NAME_DB})} ? ${NAME_CID} : ${NAME_DB})}) Entry: Bad Belgian CID through google voice. Date: Sat Oct 25 12:43:47 EDT 2014 Callin google voice number using betamax with belgian CID 32 12 345678 passes it on incorrectly as 1 321 234 5678. On google voice panel this is set correctly, so it might be Callcentric that adds the '1'. How to fix? Maybe it is not such a problem since belgion numbers will come in on different provider (which has its own caller id problems..) Entry: Peru betamax Date: Fri Jan 9 20:49:28 EST 2015 sipdiscount.com (us free - 0.005) Peru: 0.035 mobile 0.005 landline Entry: Sending SMS Date: Sat Jan 17 17:29:47 EST 2015 Using HTML SMSlink You can also send text messages (SMS) without using our software or accessing the website. Use the following link and fill in the desired data: https://www.sipdiscount.com/myaccount/sendsms.php?username=xxxxxxxxxx&password=xxxxxxxxxx&from=xxxxxxxxxx&to=xxxxxxxxxx&text=xxxxxxxxxx Explanation of the variables: username: your SIPDiscount username password: your SIPDiscount password from: your username or your verified phone number. Always use international format for the number starting with +, for instance +491701234567 to: the number you wish to send the sms to. Always use international format starting with +, for instance +491701234567 text: the message you want to send Entry: Connecting calls Date: Mon Jan 12 14:26:08 EST 2015 #!/bin/bash [ -z "$2" ] && echo "usage: $0 " && exit 1 CMD=/var/spool/asterisk/outgoing/call-$(date '+%s') cat <$CMD Channel: $1 Application: Dial Data: $2 EOF Not sure here how to do this on two external numbers. asterisk.outgoing SIP/18 SIP/outbound_tom/ asterisk.outgoing SIP/outbound_mel/ SIP/outbound_tom/ Entry: SIP tutorial Date: Mon Aug 15 12:14:15 EDT 2016 http://www.siptutorial.net/SIP http://www.siptutorial.net/SDP http://www.siptutorial.net/RTP https://en.wikipedia.org/wiki/Session_Description_Protocol Entry: SIP response 500 "Internal server error" Date: Tue Aug 1 23:19:08 EDT 2017 -- Got SIP response 500 "Internal server error" back from 77.72.169.131:5060 Since about a month or so. Possibly coincides with server update or some other change. I've not been really meticulous about changes, since it always just worked after getting it to run the first time. Support says to try again later. It's been consistent trying to call BE cell phones. Land lines had a problem but that seems to be solved last time I tried. Maybe good though to have a look at the SIP trace, to see if there is anything funny. Before doing so, maybe also turn off some off the junk traffic. Anyway it should be easy to filter this in wireshark. EDIT: Solved Setting Belgian number as caller ID fixed it.