]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
tests/test_cel: Fix CEL unit tests
authorMatthew Jordan <mjordan@digium.com>
Mon, 17 Nov 2014 15:15:30 +0000 (15:15 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 17 Nov 2014 15:15:30 +0000 (15:15 +0000)
This is a backport of the test_cel portion of r427870, which was not applied to
the 12 branch. This fixes the compilation issues with the CEL unit tests
introduced by the API changes needed to fix publication of blind transfer
messages.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@428104 65c4cc65-6c06-0410-ace0-fbb531ad65f3

tests/test_cel.c

index 9e5d571f87efd87eb21e5fa651c62cf8ad4d3f7a..2ec3077c668b83143dd4ebfec51ec2d14c49022e 100644 (file)
@@ -1224,9 +1224,9 @@ AST_TEST_DEFINE(test_cel_blind_transfer)
        RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
        RAII_VAR(struct ast_channel *, chan_bob, NULL, safe_channel_release);
        RAII_VAR(struct ast_bridge *, bridge, NULL, safe_bridge_destroy);
+       RAII_VAR(struct ast_blind_transfer_message *, transfer_msg, NULL, ao2_cleanup);
        struct ast_party_caller alice_caller = ALICE_CALLERID;
        struct ast_party_caller bob_caller = BOB_CALLERID;
-       struct ast_bridge_channel_pair pair;
 
        switch (cmd) {
        case TEST_INIT:
@@ -1252,12 +1252,21 @@ AST_TEST_DEFINE(test_cel_blind_transfer)
        BRIDGE_ENTER(chan_bob, bridge);
        BRIDGE_ENTER(chan_alice, bridge);
 
-       pair.bridge = bridge;
-       pair.channel = chan_alice;
        ast_bridge_lock(bridge);
-       ast_bridge_publish_blind_transfer(1, AST_BRIDGE_TRANSFER_SUCCESS,
-               &pair, "transfer_context", "transfer_extension", NULL, NULL);
+       transfer_msg = ast_blind_transfer_message_create(1, chan_alice,
+                       "transfer_extension", "transfer_context");
+       if (!transfer_msg) {
+               ast_test_status_update(test, "Failed to create transfer Stasis message\n");
+               return AST_TEST_FAIL;
+       }
+       transfer_msg->bridge = ast_bridge_snapshot_create(bridge);
+       if (!transfer_msg->bridge) {
+               ast_test_status_update(test, "Failed to create bridge snapshot\n");
+               return AST_TEST_FAIL;
+       }
        ast_bridge_unlock(bridge);
+       transfer_msg->result = AST_BRIDGE_TRANSFER_SUCCESS;
+       ast_bridge_publish_blind_transfer(transfer_msg);
        BLINDTRANSFER_EVENT(chan_alice, bridge, "transfer_extension", "transfer_context");
 
        BRIDGE_EXIT(chan_alice, bridge);