asterisk-chan-dongle: allow user to send USSD commands directly
authorJiri Slachta <slachta@cesnet.cz>
Sun, 29 Jun 2014 18:58:57 +0000 (20:58 +0200)
committerJiri Slachta <slachta@cesnet.cz>
Sun, 29 Jun 2014 18:58:57 +0000 (20:58 +0200)
Signed-off-by: Jiri Slachta <slachta@cesnet.cz>
net/asterisk-11.x-chan-dongle/Makefile
net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch [new file with mode: 0644]

index 6f3eba1..24f922d 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=asterisk11-chan-dongle
 PKG_VERSION:=1.1r35
 PKG_REV:=28a46567a88cebdc365db6f294e682246fd2dd7b
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_SUBDIR:=asterisk11-chan-dongle-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
diff --git a/net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch b/net/asterisk-11.x-chan-dongle/patches/001-add-send-ussd.patch
new file mode 100644 (file)
index 0000000..4ea41b1
--- /dev/null
@@ -0,0 +1,64 @@
+--- a/app.c
++++ b/app.c
+@@ -114,7 +114,44 @@
+       return !status;
+ }
++static int app_send_ussd_exec (attribute_unused struct ast_channel* channel, const char* data) 
++{ 
++        char*   parse; 
++        const char* msg; 
++        int status; 
++        void * msgid; 
++        AST_DECLARE_APP_ARGS (args, 
++                AST_APP_ARG (device); 
++                AST_APP_ARG (ussd); 
++        ); 
++
++        if (ast_strlen_zero (data)) 
++        { 
++                return -1; 
++        } 
++
++        parse = ast_strdupa (data); 
++
++        AST_STANDARD_APP_ARGS (args, parse); 
++
++        if (ast_strlen_zero (args.device)) 
++        { 
++                ast_log (LOG_ERROR, "NULL device for ussd -- USSD will not be sent\n"); 
++                return -1; 
++        } 
++
++        if (ast_strlen_zero (args.ussd)) 
++        { 
++                ast_log (LOG_ERROR, "NULL ussd command -- USSD will not be sent\n"); 
++                return -1; 
++        } 
++
++        msg = send_ussd(args.device, args.ussd, &status, &msgid); 
++        if(!status) 
++                ast_log (LOG_ERROR, "[%s] %s with id %p\n", args.device, msg, msgid); 
++        return !status; 
++} 
+ static const struct dongle_application
+ {
+@@ -144,7 +181,15 @@
+               "  Message  - text of the message\n"
+               "  Validity - Validity period in minutes\n"
+               "  Report   - Boolean flag for report request\n"
+-      }
++      },
++        { 
++                "DongleSendUSSD", 
++                app_send_ussd_exec, 
++                "DongleSendUSSD(Device,USSD)", 
++                "DongleSendUSSD(Device,USSD)\n" 
++                "  Device   - Id of device from dongle.conf\n" 
++                "  USSD     - ussd command\n" 
++        }
+ };
+ #if ASTERISK_VERSION_NUM >= 10800