Add test case for test the value of force_outbound_calls_to_peer pref and caller_force_outbound_calls_to_peer

(cherry picked from commit 0ba8d41f45)
squeeze-backports
Victor Seva 12 years ago
parent 1fdf196a30
commit be5cbde782

@ -136,6 +136,8 @@ TestNGCP = {} --class
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(nil)
self.cur:close()
self.con:close()
@ -149,6 +151,9 @@ TestNGCP = {} --class
assertEquals(sr.pv.get("$avp(caller_sst_enable)"), "no")
assertEquals(sr.pv.get("$xavp(caller_real_prefs=>sst_refresh_method)"), "UPDATE_FALLBACK_INVITE")
assertEquals(sr.pv.get("$avp(caller_sst_refresh_method)"), "UPDATE_FALLBACK_INVITE")
assertEquals(sr.pv.get("$xavp(caller_usr_prefs=>force_outbound_calls_to_peer)"), 1)
assertEquals(sr.pv.get("$xavp(caller_real_prefs=>force_outbound_calls_to_peer)"), 1)
assertEquals(sr.pv.get("$avp(caller_force_outbound_calls_to_peer)"), 1)
end
function TestNGCP:test_callee_usr_load_empty()
@ -170,6 +175,7 @@ TestNGCP = {} --class
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(self.up_vars:val("ae736f72_21d1_4ea6_a3ea_4d7f56b3887c"))
self.cur:fetch(mc.ANYARGS) ;mc :returns(nil)
self.cur:close()
self.con:close()
@ -347,6 +353,16 @@ TestNGCP = {} --class
assertEquals(sr.pv.get("$xavp(callee_dom_prefs=>dummy)"), "callee")
end
function TestNGCP:test_callee_clean_2()
sr.pv.seti("$xavp(caller_usr_prefs=>force_outbound_calls_to_peer)", 1)
sr.pv.seti("$xavp(caller_real_prefs=>force_outbound_calls_to_peer)", 1)
sr.pv.seti("$avp(caller_force_outbound_calls_to_peer)", 1)
assertEquals(sr.pv.get("$avp(caller_force_outbound_calls_to_peer)"), 1)
TestNGCP:test_callee_usr_load()
self.ngcp:clean('callee', 'usr')
assertEquals(sr.pv.get("$avp(caller_force_outbound_calls_to_peer)"), 1)
end
function TestNGCP:test_caller_clean()
local avp = NGCPAvp:new('callee_outbound_from_display')
avp("foofighters")
@ -546,7 +562,7 @@ TestNGCP = {} --class
function TestNGCP:test_str_var()
self:test_caller_usr_load()
assertEquals(self.ngcp:_str_var("caller", "usr"), "{$avp(s:allowed_ips_grp):nil,$avp(s:man_allowed_ips_grp):nil,$avp(s:ignore_allowed_ips):nil,$avp(s:caller_account_id):2,$avp(s:caller_cc):43,$avp(s:caller_ac):1,$avp(s:caller_emergency_cli):nil,$avp(s:caller_emergency_prefix):nil,$avp(s:caller_emergency_suffix):nil,$avp(s:caller_lock):nil,$avp(s:caller_block_override):nil,$avp(s:caller_adm_block_override):nil,$avp(s:caller_allowed_clis):nil,$avp(s:caller_user_cli):nil,$avp(s:caller_block_out_mode):nil,$avp(s:caller_block_out_list):nil,$avp(s:caller_adm_block_out_mode):nil,$avp(s:caller_adm_block_out_list):nil,$avp(s:caller_peer_auth_user):nil,$avp(s:caller_peer_auth_pass):nil,$avp(s:caller_peer_auth_realm):nil,$avp(s:caller_ext_subscriber_id):nil,$avp(s:caller_ext_contract_id):nil,$avp(s:caller_prepaid):nil,$avp(s:caller_ring_group_dest):nil,$avp(s:caller_ring_group_policy):nil,$avp(s:caller_no_nat_sipping):nil,$avp(s:caller_reject_emergency):nil,$avp(s:caller_ncos_id):nil,$avp(s:caller_inbound_upn):from_user,$avp(s:caller_extension_in_npn):nil,$avp(s:caller_inbound_uprn):npn,$avp(s:caller_ipv46_for_rtpproxy):nil,$avp(s:caller_force_outbound_calls_to_peer):nil,$avp(s:caller_use_rtpproxy):nil,$avp(s:rewrite_caller_in_dpid):nil,$avp(s:rewrite_callee_in_dpid):nil,$avp(s:caller_ip_header):P-NGCP-Src-Ip,$avp(s:caller_allow_out_foreign_domain):nil,$avp(s:caller_concurrent_max):nil,$avp(s:caller_concurrent_max_out):nil,$avp(s:caller_concurrent_max_per_account):nil,$avp(s:caller_concurrent_max_out_per_account):nil,$avp(s:caller_sst_enable):no,$avp(s:caller_sst_expires):300,$avp(s:caller_sst_min_timer):90,$avp(s:caller_sst_max_timer):7200,$avp(s:caller_sst_refresh_method):UPDATE_FALLBACK_INVITE,$avp(s:caller_cloud_pbx):nil,}\n")
assertEquals(self.ngcp:_str_var("caller", "usr"), "{$avp(s:allowed_ips_grp):nil,$avp(s:man_allowed_ips_grp):nil,$avp(s:ignore_allowed_ips):nil,$avp(s:caller_account_id):2,$avp(s:caller_cc):43,$avp(s:caller_ac):1,$avp(s:caller_emergency_cli):nil,$avp(s:caller_emergency_prefix):nil,$avp(s:caller_emergency_suffix):nil,$avp(s:caller_lock):nil,$avp(s:caller_block_override):nil,$avp(s:caller_adm_block_override):nil,$avp(s:caller_allowed_clis):nil,$avp(s:caller_user_cli):nil,$avp(s:caller_block_out_mode):nil,$avp(s:caller_block_out_list):nil,$avp(s:caller_adm_block_out_mode):nil,$avp(s:caller_adm_block_out_list):nil,$avp(s:caller_peer_auth_user):nil,$avp(s:caller_peer_auth_pass):nil,$avp(s:caller_peer_auth_realm):nil,$avp(s:caller_ext_subscriber_id):nil,$avp(s:caller_ext_contract_id):nil,$avp(s:caller_prepaid):nil,$avp(s:caller_ring_group_dest):nil,$avp(s:caller_ring_group_policy):nil,$avp(s:caller_no_nat_sipping):no,$avp(s:caller_reject_emergency):nil,$avp(s:caller_ncos_id):nil,$avp(s:caller_inbound_upn):from_user,$avp(s:caller_extension_in_npn):nil,$avp(s:caller_inbound_uprn):npn,$avp(s:caller_ipv46_for_rtpproxy):nil,$avp(s:caller_force_outbound_calls_to_peer):1,$avp(s:caller_use_rtpproxy):nil,$avp(s:rewrite_caller_in_dpid):nil,$avp(s:rewrite_callee_in_dpid):nil,$avp(s:caller_ip_header):P-NGCP-Src-Ip,$avp(s:caller_allow_out_foreign_domain):nil,$avp(s:caller_concurrent_max):nil,$avp(s:caller_concurrent_max_out):nil,$avp(s:caller_concurrent_max_per_account):nil,$avp(s:caller_concurrent_max_out_per_account):nil,$avp(s:caller_sst_enable):no,$avp(s:caller_sst_expires):300,$avp(s:caller_sst_min_timer):90,$avp(s:caller_sst_max_timer):7200,$avp(s:caller_sst_refresh_method):UPDATE_FALLBACK_INVITE,$avp(s:caller_cloud_pbx):nil,}\n")
end
-- class TestNGCP
--EOF

@ -49,6 +49,16 @@ up_vars = {
type = 0,
value = "no",
last_modified = "1900-01-01 00:00:01"
},
{
id = 11,
uuid = "ae736f72-21d1-4ea6-a3ea-4d7f56b3887c",
username = "testuser1",
domain = "192.168.51.56",
attribute = "force_outbound_calls_to_peer",
type = 1,
value = 1,
last_modified = "1900-01-01 00:00:01"
}
},
_94023caf_dfba_4f33_8bdb_b613ce627613 = {

Loading…
Cancel
Save