]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding API to send T.38 CNG tone notify to MGC
authorKapil <kgupta@sangoma.com>
Mon, 30 Jul 2012 20:48:53 +0000 (16:48 -0400)
committerKapil <kgupta@sangoma.com>
Mon, 30 Jul 2012 20:48:53 +0000 (16:48 -0400)
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h

index e8cb79097befa4d0ee6d743d790831b3e6c70450..080ca4b709f7418c6c14a5494d7bd7c10f4e17f5 100644 (file)
@@ -146,23 +146,39 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
                         }
                     case 5:
                         {
-                            /* mg profile <profile-name> send ito notify */
                             if(zstr(argv[3])){
                                 goto usage;
                             }
 
-                            if(strcasecmp(argv[3],"ito")){
+                          /*************************************************************************/
+                            if(!strcasecmp(argv[3],"ito")){
+                                /* mg profile <profile-name> send ito notify */
+
+                                printf("Sending In-Activity  NOTIFY \n");
+
+                                megaco_profile_release(profile);
+                                mg_send_ito_notify(profile);
+                          /*************************************************************************/
+                            }else if(!strcasecmp(argv[3],"cng")){
+                          /*************************************************************************/
+                                /* mg profile <profile-name> send cng <term-id> */
+
+                                if(zstr(argv[4])){
+                                    goto usage;
+                                }
+                                megaco_profile_release(profile);
+                                mg_send_t38_cng_notify(profile, argv[4]);
+                                
+                          /*************************************************************************/
+                            }else {
                                 stream->write_function(stream, "-ERR wrong input \n");
                                 goto usage;
                             }
-
-                            printf("Sending In-Activity  NOTIFY \n");
-
-                            megaco_profile_release(profile);
-                            mg_send_ito_notify(profile);
+                          /*************************************************************************/
 
                             break;
                         }
+
                     default:
                         {
                             goto usage;
index a1fd12b3dfa22659324fa53491f07a898eabbe6c..5a7786839b477a0de3bea76dba9aca09b74fdc6b 100644 (file)
@@ -2480,6 +2480,53 @@ switch_status_t  mg_send_ito_notify(megaco_profile_t* mg_profile )
 
     return mg_send_notify(mg_profile, "ROOT", oevt);
 }
+
+/*****************************************************************************************************************************/
+/* API to send T.38 CNG tone Notification */
+
+switch_status_t  mg_send_t38_cng_notify(megaco_profile_t* mg_profile, const char* term_name)
+{
+    MgMgcoObsEvt *oevt;
+    MgMgcoEvtPar* param;
+
+       switch_assert(term_name);
+       switch_assert(mg_profile);
+
+    mg_stack_alloc_mem((Ptr*)&oevt, sizeof(MgMgcoObsEvt));
+
+    oevt->pres.pres = PRSNT_NODEF;
+
+    mg_get_time_stamp(&oevt->time);
+
+    MG_INIT_TOKEN_VALUE(&(oevt->pkg.pkgType), MGT_PKG_KNOWN);
+
+    MG_INIT_TOKEN_VALUE(&(oevt->pkg.valType), MGT_PKG_KNOWN);
+
+    MG_INIT_TOKEN_VALUE(&(oevt->pkg.u.val), MGT_PKG_CALL_TYP_DISCR);
+
+    MG_INIT_TOKEN_VALUE(&(oevt->name.type),MGT_GEN_TYPE_KNOWN);
+
+    MG_INIT_TOKEN_VALUE(&(oevt->name.u.val),(U8)MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYPCNG);
+
+    if (mgUtlGrowList((void ***)&oevt->pl.parms, sizeof(MgMgcoEvtPar), &oevt->pl.num, NULL) != ROK) {
+        switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
+        return SWITCH_STATUS_FALSE;
+    }
+
+    param = oevt->pl.parms[0];
+
+    MG_INIT_TOKEN_VALUE(&(param->type),(U8)MGT_EVTPAR_OTHER);
+
+    MG_INIT_TOKEN_VALUE(&(param->u.other.name.type),MGT_GEN_TYPE_KNOWN);
+    MG_INIT_TOKEN_VALUE(&(param->u.other.name.u.val), MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYP);
+
+    MG_INIT_TOKEN_VALUE(&(param->u.other.val.type),MGT_VALUE_EQUAL);
+    MG_INIT_TOKEN_VALUE(&(param->u.other.val.u.eq.type),MGT_VALTYPE_ENUM);
+    MG_INIT_TOKEN_VALUE(&(param->u.other.val.u.eq.u.enume),MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYPCNG);
+
+
+    return mg_send_notify(mg_profile, term_name, oevt);
+}
 /*****************************************************************************************************************************/
 /* API to send DTMF Digits Notification */
 
index 4d79a960788cbdbc462a1edefc6936a0283aa2cc..28ff0c2c032233009d6369abdb8d2002e6ab20f5 100644 (file)
@@ -167,6 +167,9 @@ switch_status_t mg_add_local_descriptor(MgMgcoMediaDesc* media, megaco_profile_t
 switch_status_t mg_send_term_service_change(char *span_name, char *chan_number, mg_term_states_e term_state); 
 
 
+switch_status_t  mg_send_t38_cng_notify(megaco_profile_t* mg_profile, const char* term_name);
+
+
 switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
 switch_status_t sng_mgco_init(sng_mg_event_interface_t* event);
 switch_status_t sng_mgco_stack_shutdown(void);