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.
remove the punctuation from the number....
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
participants (2)
-
David Rodrigues
-
Michael Jerris