From cb8c35cd518bba3caedd16a923464a956e3eb4f4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 10 Aug 2010 20:24:24 +0800 Subject: mgcp: Speculative mgcp fix... We really have 32 channels per multiplex... so use the right number... or at least it seems we do have 32. --- openbsc/include/openbsc/mgcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 38fe50482..02abeea39 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -147,7 +147,7 @@ static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot) { if (timeslot == 0) timeslot = 1; - return timeslot + (31 * multiplex); + return timeslot + (32 * multiplex); } -- cgit v1.2.3 From 82049d81413c23f08e7a5418f30676001e1a4588 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Aug 2010 17:59:15 +0800 Subject: mgcp: Add method to go back from endpoint to multiplex/timeslot --- openbsc/include/openbsc/mgcp.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 02abeea39..ed070cdbc 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -150,5 +150,14 @@ static inline int mgcp_timeslot_to_endpoint(int multiplex, int timeslot) 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; +} + #endif -- cgit v1.2.3 From f4b343920668280b39ddb95209f6ab0ceccab630 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Aug 2010 16:08:39 +0800 Subject: nat: Make the code work in terms of endpoints instead of timeslot/multiplex We are going to have more than one trunk, so all code hardcoding the multiplex to zero must go. Avoid this kind of problem by saving the MGCP endpoint number and comparing that. --- openbsc/include/openbsc/bsc_nat_sccp.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat_sccp.h b/openbsc/include/openbsc/bsc_nat_sccp.h index 73e9c690c..fcfd23beb 100644 --- a/openbsc/include/openbsc/bsc_nat_sccp.h +++ b/openbsc/include/openbsc/bsc_nat_sccp.h @@ -79,10 +79,13 @@ struct sccp_connections { int con_type; int con_local; - /* GSM audio handling. That is 32 * multiplex + ts */ + /* + * audio handling. Remember if we have ever send a CRCX, + * remember the endpoint used by the MSC and BSC. + */ int crcx; - int msc_timeslot; - int bsc_timeslot; + int msc_endp; + int bsc_endp; /* timeout handling */ struct timespec creation_time; -- cgit v1.2.3 From 39cd32e650d490ba2d5e74f2df90a3f12514d618 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Aug 2010 18:11:07 +0800 Subject: nat: Remove the CRCX value from the nat Assume that if the MSC has assigned a timeslot/multiplex it will also be used for the MGCP. So we just assume that it was allocated on the BSC as well... in the worse case we will send a DLCX downstream but it should be fine. --- openbsc/include/openbsc/bsc_nat_sccp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat_sccp.h b/openbsc/include/openbsc/bsc_nat_sccp.h index fcfd23beb..4f1afcb2b 100644 --- a/openbsc/include/openbsc/bsc_nat_sccp.h +++ b/openbsc/include/openbsc/bsc_nat_sccp.h @@ -83,7 +83,6 @@ struct sccp_connections { * audio handling. Remember if we have ever send a CRCX, * remember the endpoint used by the MSC and BSC. */ - int crcx; int msc_endp; int bsc_endp; -- cgit v1.2.3 From 45fd07dc33b5dd845e2b266adda5d24a4d500f96 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Aug 2010 18:22:14 +0800 Subject: nat: Attempt to assign the BSC Timeslot based on a free list Do attempt to not reassign an endpoint immediately but go to the next free one. --- openbsc/include/openbsc/bsc_nat.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 5f746f237..11c24dc60 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[33]; + int last_endpoint; + /* a back pointer */ struct bsc_nat *nat; }; @@ -253,7 +257,7 @@ 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); -- cgit v1.2.3 From f7c86c5b4d8f7d909595c0f01fcfaf5da4c4e7c4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 30 Aug 2010 13:44:32 +0800 Subject: nat: Replace the MGCP Endpoint if that is required Add code to replace the Endpoint number for the mgcp. --- openbsc/include/openbsc/bsc_nat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 11c24dc60..25b6429c4 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -264,7 +264,7 @@ 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); -- cgit v1.2.3 From 85902a4d4a53094e8ab4cb242e8de1f6ce431f9e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 1 Sep 2010 09:31:46 +0800 Subject: nat: We have 1 to 31 available to the BSC. --- openbsc/include/openbsc/bsc_nat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 25b6429c4..0c9af9184 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -76,7 +76,7 @@ struct bsc_connection { struct timer_list pong_timeout; /* mgcp related code */ - int endpoint_status[33]; + int endpoint_status[32]; int last_endpoint; /* a back pointer */ -- cgit v1.2.3