diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway.c b/src/mod/endpoints/mod_media_gateway/media_gateway.c index 9df5e2a2e0..63646c4943 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway.c @@ -125,6 +125,9 @@ switch_status_t megaco_activate_termination(mg_termination_t *term) switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, kRFC2833PT, "%d", term->u.rtp.rfc2833_pt); switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, kRATE, "%d", term->u.rtp.rate); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, kCODEC, term->u.rtp.codec); + + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, kMEDIATYPE, mg_media_type2str(term->u.rtp.media_type)); + } else if (term->type == MG_TERM_TDM) { switch_snprintf(dialstring, sizeof dialstring, "tdm/%s", term->name); diff --git a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h index 46f850ff16..4285526af3 100644 --- a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h +++ b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h @@ -79,6 +79,7 @@ typedef struct mg_context_s mg_context_t; #define kRFC2833PT "rfc2833_pt" #define kMODE "mode" #define kRATE "rate" +#define kMEDIATYPE "media_type" /* TDM parameters understood by the controllable channel */ #define kSPAN_ID "span" @@ -96,6 +97,32 @@ enum { } mg_termination_flags; + +typedef enum { + MGM_AUDIO = 0, + MGM_IMAGE, + MGM_INVALID +} mg_media_type_t; + +static inline const char *mg_media_type2str(mg_media_type_t type) { + switch (type) { + case MGM_AUDIO: + return "audio"; + case MGM_IMAGE: + return "image"; + case MGM_INVALID: + return NULL; + } +} + +static inline mg_media_type_t mg_media_type_parse(const char *str) { + if (!strcasecmp(str, "audio")) { + return MGM_AUDIO; + } else if (!strcasecmp(str, "image")) { + return MGM_IMAGE; + } +} + struct mg_context_s { uint32_t context_id; mg_termination_t *terminations[MG_CONTEXT_MAX_TERMS]; @@ -133,6 +160,8 @@ struct mg_termination_s { int rate; /*!< Sampling rate */ const char *codec; /*!< Codec to use, using the freeswitch nomenclature. This could be "PCMU" for G711.U, "PCMA" for G711.A, or "G729" for g729 */ int term_id; + switch_t38_options_t t38_options; + mg_media_type_t media_type; } rtp; struct {