add t38_options and media_type to rtp term

This commit is contained in:
Mathieu Rene 2012-08-09 11:15:07 -04:00
parent e0a7c69ca0
commit c8c85fc27f
2 changed files with 32 additions and 0 deletions

View File

@ -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);

View File

@ -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 {