VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
drodrig at magicbrain.com Guest
|
|
Back to top |
|
|
rtreleaven at bunnykic... Guest
|
Posted: Sun Mar 06, 2016 3:58 pm Post subject: [Freeswitch-users] Mod_sms and script to send to Twilio |
|
|
I think the console message and the script are missing from you email.
On Sat, Mar 5, 2016 at 3:29 PM, drodrig <drodrig@magicbrain.com (drodrig@magicbrain.com)> wrote:
|
|
Back to top |
|
|
mike at jerris.com Guest
|
Posted: Wed Mar 09, 2016 5:20 pm Post subject: [Freeswitch-users] Mod_sms and script to send to Twilio |
|
|
remove the punctuation from the number....
Quote: | On Mar 8, 2016, at 1:09 PM, David Rodrigues <drodrig@magicbrain.com> wrote:
Thank you. I'm new to the mailing list. I had my mail client set for
html. Perhaps that was the problem. Here is the Python script:
#/usr/bin/env python
import re
import pprint
import sys
import urllib
import subprocess
from freeswitch import *
ACCOUNTSID = 'my-account-sid'
AUTHTOKEN = 'my-auth-token'
PHONENUMBER = '+my-source-phone-number'
def chat(message, args):
to_phone = '+1' + re.sub('\D', '',
urllib.unquote(message.getHeader('to_user'))).lstrip('+1')
body = message.getBody()
subprocess.call("curl -X POST
'https://api.twilio.com/2010-04-01/Accounts/'" + ACCOUNTSID +
"/Messages.json --data-urlencode 'To=" + to_phone + "'
--data-urlencode " +
"'From=+" + PHONENUMBER + "' --data-urlencode 'Body=" + body
+ "' -u " +
ACCOUNTSID + ":" + AUTHTOKEN, shell=True)
Here is my chatplan XML file:
<?xml version="1.0" encoding="utf-8"?>
<include>
<context name="public">
<extension name="100">
<condition field="to" expression="^(.*)$">
<action application="python" data="sms"/>
</condition>
</extension>
</context>
</include>
And here is the error (keep in mind that the script actually works
fine. I receive the SMS as expected):
2016-03-05 15:17:54.040913 [DEBUG] mod_python.c:286 Finished calling
python script
2016-03-05 15:17:54.040913 [WARNING] sofia_presence.c:221 Not sending
to local box for (XXX)%CX%A0XXX-XXX@my.sipdomain.com <-- (Note that I
substituted Xs for the actual phone digits just for this post)
2016-03-05 15:17:54.040913 [ERR] sofia_presence.c:272 Chat proto [sip]
from ["d100" <sip:100@my.sipdomain.com>;tag=0b2cec63]
to [(XXX)%CX%A0XXX-XXX@my.sipdomain.com]
Test sms
Nobody to send to: Profile internal
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
|
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|