diff options
Diffstat (limited to 'openbsc/include')
-rw-r--r-- | openbsc/include/openbsc/bsc_nat.h | 8 | ||||
-rw-r--r-- | openbsc/include/openbsc/bsc_nat_sccp.h | 10 | ||||
-rw-r--r-- | openbsc/include/openbsc/mgcp.h | 11 |
3 files changed, 22 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 5f746f237..0c9af9184 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -75,6 +75,10 @@ struct bsc_connection { struct timer_list ping_timeout; struct timer_list pong_timeout; + /* mgcp related code */ + int endpoint_status[32]; + int last_endpoint; + /* a back pointer */ struct bsc_nat *nat; }; @@ -253,14 +257,14 @@ struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat * MGCP/Audio handling */ int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length); -int bsc_mgcp_assign(struct sccp_connections *, struct msgb *msg); +int bsc_mgcp_assign_patch(struct sccp_connections *, struct msgb *msg); void bsc_mgcp_init(struct sccp_connections *); void bsc_mgcp_dlcx(struct sccp_connections *); void bsc_mgcp_free_endpoints(struct bsc_nat *nat); int bsc_mgcp_nat_init(struct bsc_nat *nat); struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number); -struct msgb *bsc_mgcp_rewrite(char *input, int length, const char *ip, int port); +struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port); void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg); void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc); diff --git a/openbsc/include/openbsc/bsc_nat_sccp.h b/openbsc/include/openbsc/bsc_nat_sccp.h index 73e9c690c..4f1afcb2b 100644 --- a/openbsc/include/openbsc/bsc_nat_sccp.h +++ b/openbsc/include/openbsc/bsc_nat_sccp.h @@ -79,10 +79,12 @@ struct sccp_connections { int con_type; int con_local; - /* GSM audio handling. That is 32 * multiplex + ts */ - int crcx; - int msc_timeslot; - int bsc_timeslot; + /* + * audio handling. Remember if we have ever send a CRCX, + * remember the endpoint used by the MSC and BSC. + */ + int msc_endp; + int bsc_endp; /* timeout handling */ struct timespec creation_time; diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 38fe50482..ed070cdbc 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -147,7 +147,16 @@ static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot) { if (timeslot == 0) timeslot = 1; - return timeslot + (31 * multiplex); + return timeslot + (32 * multiplex); +} + +static inline void mgcp_endpoint_to_timeslot(int endpoint, int *multiplex, int *timeslot) +{ + *multiplex = endpoint / 32; + *timeslot = endpoint % 32; + + if (*timeslot == 1) + *timeslot = 0; } |