From 2d115d4bbb5b725c84bb00e7dd9ac9130e3b0789 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 10 Dec 2012 15:50:09 +0100 Subject: mgcp: Merge the current MGCP code from OpenBSC There were several changes in the upstream code. These include statistics, DTMF/RQNT, changes in the parsing code and re-transmission handling. The last item is the main reason to do the merge now. --- include/mgcp/mgcp.h | 9 +++++++-- include/mgcp/mgcp_internal.h | 24 +++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/mgcp/mgcp.h b/include/mgcp/mgcp.h index cde4594..ad88bfd 100644 --- a/include/mgcp/mgcp.h +++ b/include/mgcp/mgcp.h @@ -83,7 +83,7 @@ typedef int (*mgcp_realloc)(struct mgcp_trunk_config *cfg, int endpoint); typedef int (*mgcp_change)(struct mgcp_trunk_config *cfg, int endpoint, int state); typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int state, const char *transactio_id); typedef int (*mgcp_reset)(struct mgcp_trunk_config *cfg); -typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone, const char *data); +typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone); #define PORT_ALLOC_STATIC 0 #define PORT_ALLOC_DYNAMIC 1 @@ -116,6 +116,8 @@ struct mgcp_trunk_config { int audio_payload; int audio_loop; + int omit_rtcp; + /* spec handling */ int force_realloc; @@ -188,12 +190,12 @@ int mgcp_vty_init(void); int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg); void mgcp_free_endp(struct mgcp_endpoint *endp); int mgcp_reset_transcoder(struct mgcp_config *cfg); +void mgcp_format_stats(struct mgcp_endpoint *endp, char *stats, size_t size); /* * format helper functions */ struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg); -struct msgb *mgcp_create_response_with_data(int code, const char *txt, const char *msg, const char *trans, const char *data); /* adc helper */ static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot) @@ -212,5 +214,8 @@ static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int * *timeslot = endpoint % 32; } +int mgcp_send_reset_ep(struct mgcp_endpoint *endp, int endpoint); +int mgcp_send_reset_all(struct mgcp_config *cfg); + #endif diff --git a/include/mgcp/mgcp_internal.h b/include/mgcp/mgcp_internal.h index 6b2989d..cf2e9fd 100644 --- a/include/mgcp/mgcp_internal.h +++ b/include/mgcp/mgcp_internal.h @@ -1,8 +1,8 @@ /* MGCP Private Data */ /* - * (C) 2009-2011 by Holger Hans Peter Freyther - * (C) 2009-2011 by On-Waves + * (C) 2009-2012 by Holger Hans Peter Freyther + * (C) 2009-2012 by On-Waves * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -47,16 +47,22 @@ struct mgcp_rtp_state { uint32_t orig_ssrc; uint32_t ssrc; - uint16_t seq_no; - int lost_no; + + uint16_t base_seq; + uint16_t max_seq; int seq_offset; + int cycles; + uint32_t last_timestamp; int32_t timestamp_offset; + uint32_t jitter; + int32_t transit; }; struct mgcp_rtp_end { /* statistics */ unsigned int packets; + unsigned int octets; struct in_addr addr; /* in network byte order */ @@ -121,6 +127,10 @@ struct mgcp_endpoint { /* SSRC/seq/ts patching for loop */ int allow_patch; + /* fields for re-transmission */ + char *last_trans; + char *last_response; + /* tap for the endpoint */ struct mgcp_rtp_tap taps[MGCP_TAP_COUNT]; @@ -139,9 +149,6 @@ struct mgcp_msg_ptr { unsigned int length; }; -int mgcp_analyze_header(struct mgcp_config *cfg, struct msgb *msg, - struct mgcp_msg_ptr *ptr, int size, - const char **transaction_id, struct mgcp_endpoint **endp); int mgcp_send_dummy(struct mgcp_endpoint *endp); int mgcp_bind_bts_rtp_port(struct mgcp_endpoint *endp, int rtp_port); int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port); @@ -161,5 +168,8 @@ struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index); struct mgcp_trunk_config *mgcp_trunk_domain(struct mgcp_config *cfg, const char *); void mgcp_trunk_free(struct mgcp_trunk_config *cfg); +void mgcp_state_calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *, + uint32_t *expected, int *loss); +uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *); #endif -- cgit v1.2.3