bc59bf927c15676983b77393091d36afaf7c4892
[feed/telephony.git] / net / asterisk-11.x-chan-dongle / patches / 001-add-send-ussd.patch
1 --- a/app.c
2 +++ b/app.c
3 @@ -114,7 +114,44 @@ static int app_send_sms_exec (attribute_
4 return !status;
5 }
6
7 +static int app_send_ussd_exec (attribute_unused struct ast_channel* channel, const char* data)
8 +{
9 + char* parse;
10 + const char* msg;
11 + int status;
12 + void * msgid;
13
14 + AST_DECLARE_APP_ARGS (args,
15 + AST_APP_ARG (device);
16 + AST_APP_ARG (ussd);
17 + );
18 +
19 + if (ast_strlen_zero (data))
20 + {
21 + return -1;
22 + }
23 +
24 + parse = ast_strdupa (data);
25 +
26 + AST_STANDARD_APP_ARGS (args, parse);
27 +
28 + if (ast_strlen_zero (args.device))
29 + {
30 + ast_log (LOG_ERROR, "NULL device for ussd -- USSD will not be sent\n");
31 + return -1;
32 + }
33 +
34 + if (ast_strlen_zero (args.ussd))
35 + {
36 + ast_log (LOG_ERROR, "NULL ussd command -- USSD will not be sent\n");
37 + return -1;
38 + }
39 +
40 + msg = send_ussd(args.device, args.ussd, &status, &msgid);
41 + if(!status)
42 + ast_log (LOG_ERROR, "[%s] %s with id %p\n", args.device, msg, msgid);
43 + return !status;
44 +}
45
46 static const struct dongle_application
47 {
48 @@ -144,7 +181,15 @@ static const struct dongle_application
49 " Message - text of the message\n"
50 " Validity - Validity period in minutes\n"
51 " Report - Boolean flag for report request\n"
52 - }
53 + },
54 + {
55 + "DongleSendUSSD",
56 + app_send_ussd_exec,
57 + "DongleSendUSSD(Device,USSD)",
58 + "DongleSendUSSD(Device,USSD)\n"
59 + " Device - Id of device from dongle.conf\n"
60 + " USSD - ussd command\n"
61 + }
62 };
63
64 #if ASTERISK_VERSION_NUM >= 10800