diff options
Diffstat (limited to 'library/MGCP_Emulation.ttcn')
-rw-r--r-- | library/MGCP_Emulation.ttcn | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn index 494b1714..31675799 100644 --- a/library/MGCP_Emulation.ttcn +++ b/library/MGCP_Emulation.ttcn @@ -193,6 +193,19 @@ runs on MGCP_Emulation_CT { mtc.stop; } +private function f_ep_table_change_connhdlr(MGCP_ConnHdlr comp_ref, MgcpEndpoint ep) +runs on MGCP_Emulation_CT { + var integer i; + for (i := 0; i < sizeof(MgcpEndpointTable); i := i+1) { + if (MgcpEndpointTable[i].endpoint == ep) { + MgcpEndpointTable[i].comp_ref := comp_ref; + log("MGCP_Emulation_CT: MgcpEndpointTable[", i, "] now sends to ", comp_ref); + return; + } + } + setverdict(fail, "MGCP Endpoint Table: Couldn't find entry to move to ", comp_ref); + mtc.stop; +} /* Check if the given transaction ID is a pending CRCX. If yes, return true + remove */ private function f_trans_id_was_pending(MgcpTransId trans_id) @@ -280,7 +293,7 @@ function main(MGCPOps ops, MGCP_conn_parameters p, charstring id) runs on MGCP_E msg := { response := resp }; - /* If this is the resposne to a pending CRCX, extract Endpoint and store in table */ + /* If this is the response to a pending CRCX, extract Endpoint and store in table */ if (f_trans_id_was_pending(resp.line.trans_id)) { f_ep_table_add(vc_conn, f_mgcp_ep(msg)); } @@ -291,7 +304,7 @@ function main(MGCPOps ops, MGCP_conn_parameters p, charstring id) runs on MGCP_E /* MGCP from client in Multi Conn mode */ [p.multi_conn_mode] MGCP_CLIENT_MULTI.receive(MGCP_SendTo:?) -> value mst sender vc_conn { - /* If this is the resposne to a pending CRCX, extract Endpoint and store in table */ + /* If this is the response to a pending CRCX, extract Endpoint and store in table */ if (f_trans_id_was_pending(mst.msg.response.line.trans_id)) { f_ep_table_add(vc_conn, f_mgcp_ep(mst.msg)); } @@ -349,6 +362,10 @@ function main(MGCPOps ops, MGCP_conn_parameters p, charstring id) runs on MGCP_E f_ep_table_del(vc_conn, ep); MGCP_PROC.reply(MGCPEM_delete_ep:{ep, vc_conn}) to vc_conn; } + [] MGCP_PROC.getcall(MGCPEM_change_connhdlr:{?,?}) -> param(ep, vc_conn) { + f_ep_table_change_connhdlr(vc_conn, ep); + MGCP_PROC.reply(MGCPEM_change_connhdlr:{ep, vc_conn}) to vc_conn; + } } } @@ -370,9 +387,10 @@ type record ExpectData { signature MGCPEM_register(in ExpectCriteria cmd, in MGCP_ConnHdlr hdlr); signature MGCPEM_delete_ep(in MgcpEndpoint ep, in MGCP_ConnHdlr hdlr); +signature MGCPEM_change_connhdlr(in MgcpEndpoint ep, in MGCP_ConnHdlr hdlr); type port MGCPEM_PROC_PT procedure { - inout MGCPEM_register, MGCPEM_delete_ep; + inout MGCPEM_register, MGCPEM_delete_ep, MGCPEM_change_connhdlr; } with { extension "internal" }; function f_get_mgcp_by_crit(ExpectCriteria crit) @@ -400,7 +418,7 @@ return template MgcpCommand { return ret; } -/* Function that can be used as create_cb and will usse the expect table */ +/* Function that can be used as create_cb and will use the expect table */ function ExpectedCreateCallback(MgcpCommand cmd, charstring id) runs on MGCP_Emulation_CT return MGCP_ConnHdlr { var MGCP_ConnHdlr ret := null; @@ -430,7 +448,7 @@ private function f_create_expect(ExpectCriteria crit, MGCP_ConnHdlr hdlr) runs on MGCP_Emulation_CT { var integer i; - /* Check an entry like this is not already presnt */ + /* Check an entry like this is not already present */ for (i := 0; i < sizeof(MgcpExpectTable); i := i+1) { if (crit == MgcpExpectTable[i].crit) { setverdict(fail, "Crit already present", crit); @@ -455,13 +473,20 @@ function f_create_mgcp_expect(ExpectCriteria dest_number) runs on MGCP_ConnHdlr } } -/* client/conn_hdlr side function to use procedure port to create expect in emulation */ +/* client/conn_hdlr side function to use procedure port to delete expect in emulation */ function f_create_mgcp_delete_ep(MgcpEndpoint ep) runs on MGCP_ConnHdlr { MGCP_PROC.call(MGCPEM_delete_ep:{ep, self}) { [] MGCP_PROC.getreply(MGCPEM_delete_ep:{?,?}) {}; } } +/* Move MGCP handling for a given MGW endpoint to a different MGCP_ConnHdlr component. */ +function f_mgcp_change_connhdlr(MgcpEndpoint ep) runs on MGCP_ConnHdlr { + MGCP_PROC.call(MGCPEM_change_connhdlr:{ep, self}) { + [] MGCP_PROC.getreply(MGCPEM_change_connhdlr:{?,?}) {}; + } +} + private function f_expect_table_init() runs on MGCP_Emulation_CT { |