Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax.h (14840 => 14841)
--- freeswitch/branches/gmaruzz/mod_celliax/celliax.h 2009-09-13 15:59:46 UTC (rev 14840)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax.h 2009-09-13 18:53:32 UTC (rev 14841)
@@ -34,6 +34,8 @@
*
*/
+#define MY_EVENT_INCOMING_SMS "celliax::incoming_sms"
+
#undef GIOVA48
#ifndef GIOVA48
@@ -555,3 +557,4 @@
void celliax_store_boost(char *s, double *boost);
int celliax_sound_boost(void *data, int samples_num, double boost);
+int sms_incoming(private_t * tech_pvt, char *value);
Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14840 => 14841)
--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c 2009-09-13 15:59:46 UTC (rev 14840)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c 2009-09-13 18:53:32 UTC (rev 14841)
@@ -906,6 +906,9 @@
//FIXME manager_event(EVENT_FLAG_SYSTEM, "CELLIAXincomingsms",
//FIXME "Interface: %s\r\nSMS_Message: %s\r\n", tech_pvt->name,
//FIXME tech_pvt->sms_message);
+
+ res=sms_incoming(tech_pvt, tech_pvt->sms_message);
+
if (strlen(tech_pvt->sms_receiving_program)) {
int fd1[2];
pid_t pid1;
Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14840 => 14841)
--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c 2009-09-13 15:59:46 UTC (rev 14840)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c 2009-09-13 18:53:32 UTC (rev 14841)
@@ -1477,6 +1477,11 @@
return SWITCH_STATUS_FALSE;
}
+ if (switch_event_reserve_subclass(MY_EVENT_INCOMING_SMS) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
+ return SWITCH_STATUS_GENERR;
+ }
+
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
celliax_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
celliax_endpoint_interface->interface_name = "celliax";
@@ -1551,6 +1556,9 @@
}
}
+
+ switch_event_free_subclass(MY_EVENT_INCOMING_SMS);
+
switch_safe_free(globals.dialplan);
switch_safe_free(globals.context);
switch_safe_free(globals.destination);
@@ -1596,8 +1604,27 @@
return 0;
}
+int sms_incoming(private_t * tech_pvt, char *value)
+{
+ char sms_buf[512];
+ switch_event_t *event;
+ DEBUGA_CELLIAX("received SMS >>>%s<<< on interface %s\n", CELLIAX_P_LOG, value, tech_pvt->name);
+ switch_snprintf(sms_buf, sizeof(sms_buf), "incoming SMS on %s\n", tech_pvt->name);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_INCOMING_SMS) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_info", sms_buf);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_name", tech_pvt->name);
+ switch_event_add_body(event, "%s\n\n", tech_pvt->sms_message);
+ switch_event_fire(&event);
+ }
+
+ return 0;
+}
+
+
+
int new_inbound_channel(private_t * tech_pvt)
{
switch_core_session_t *session = NULL;