asterisk-chan-dongle: allow user to send USSD commands directly
Signed-off-by: Jiri Slachta <slachta@cesnet.cz>
This commit is contained in:
parent
ba78f94718
commit
04dc3e9df4
2 changed files with 65 additions and 1 deletions
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=asterisk11-chan-dongle
|
PKG_NAME:=asterisk11-chan-dongle
|
||||||
PKG_VERSION:=1.1r35
|
PKG_VERSION:=1.1r35
|
||||||
PKG_REV:=28a46567a88cebdc365db6f294e682246fd2dd7b
|
PKG_REV:=28a46567a88cebdc365db6f294e682246fd2dd7b
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE_SUBDIR:=asterisk11-chan-dongle-$(PKG_VERSION)
|
PKG_SOURCE_SUBDIR:=asterisk11-chan-dongle-$(PKG_VERSION)
|
||||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||||
|
|
|
@ -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
|
Loading…
Reference in a new issue