Modified: freeswitch/trunk/contrib/gled/esl2agi/esl2agi.c (15042 => 15043)
--- freeswitch/trunk/contrib/gled/esl2agi/esl2agi.c 2009-10-02 09:59:53 UTC (rev 15042)
+++ freeswitch/trunk/contrib/gled/esl2agi/esl2agi.c 2009-10-02 10:31:59 UTC (rev 15043)
@@ -42,6 +42,7 @@
{ {"HANGUP" , NULL}, handle_hangup },
{ {"STREAM", "FILE" , NULL}, handle_streamfile },
{ {"SET", "CALLERID" , NULL}, handle_set_caller_id },
+ { {"SET", "VARIABLE" , NULL}, handle_set_variable },
};
/*
@@ -436,6 +437,35 @@
}
/*
+ * SET VARIABLE
+ */
+static int handle_set_variable(esl_handle_t *eslC,int fd,int *argc, char *argv[]) {
+ int res;
+ int size;
+ char *buf=NULL;
+
+ if (*argc != 4)
+ return -1;
+
+ if (argv[2] && argv[3]) {
+ size = strlen(argv[2]) + strlen(argv[3]) + 1;
+ buf = malloc(size + 1);
+ snprintf(buf,size +1 ,"%s=%s",argv[2],argv[3]);
+ }
+ else
+ return -1;
+
+ res = do_execute(eslC,"set",buf,NULL,NULL);
+
+ size = safe_int_snprintf_buffer(&buf,"200 result=%d\n\n",res);
+
+ res = write(fd,buf,size);
+ free(buf);
+ return res;
+}
+
+
+/*
* STREAM FILE agi cmd
* TODO: rewrites with good string handling :)
*/
Modified: freeswitch/trunk/contrib/gled/esl2agi/esl2agi.h (15042 => 15043)
--- freeswitch/trunk/contrib/gled/esl2agi/esl2agi.h 2009-10-02 09:59:53 UTC (rev 15042)
+++ freeswitch/trunk/contrib/gled/esl2agi/esl2agi.h 2009-10-02 10:31:59 UTC (rev 15043)
@@ -111,16 +111,20 @@
static int handle_set_caller_id(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
+static int handle_set_variable(esl_handle_t *eslC,int fd,int *argc, char *argv[_MAX_CMD_ARGS]);
+
/* TODO
+ * - ANSWER : OK
* - EXEC application OPTIONS
* - GET DATA filetoplay timeout maxdigits
* - GET VARIABLE variablename
- * - HANGUP 'channelname'
+ * - HANGUP 'channelname' : TODO channel name to hangup
* - RECORD FILE filename format escapedigits timeout offsetsamples BEEP s=silence
* - SAY DIGITS
* - set autohangup time
* - set music on|off class
- * - set variable
- * - stream file filename <escape digits> [sample offset]
+ * - set variable: should be OK ( untested )
+ * - set callerid: should be OK ( untested )
+ * - stream file filename <escape digits> [sample offset] : TODO: check result offset and terminator var used ( FSCORE-455 )
* - wait for digit timeout
*/