Пожалуйста, войдите здесь. Часто задаваемые вопросы О нас
Задайте Ваш вопрос

История изменений [назад]

нажмите, чтобы скрыть/показать версии 1
изначальная версия
редактировать

спросил 2015-10-06 18:04:21 +0400

podolskiy Gravatar podolskiy

Read и ChannelRedirect (n-way call)

Добрый день! Есть кусок диалплана, который используется для редиректа противоположной стороны разговора в динамическую конференц-комнату

[macro-nway-start]
exten => s,1,Set(__CONFNO=${UNIQUEID})
        same => n,ChannelRedirect(${BRIDGEPEER},nway-conf,${CONFNO},1)
        same => n,Read(NEW_CALLEE,dial,20,i)
        same => n,Set(DYNAMIC_FEATURES=${DYNAMIC_FEATURES_NWAYINV})
        same => n,Noop(${DIAL_OPTIONS})
        same => n,ExecIf($[${REGEX("H" ${DIAL_OPTIONS})} = 0]?Set(_DIAL_OPTIONS=${DIAL_OPTIONS}H))
        same => n,Set(CALLER=${CALLERID(num)})
        same => n,Set(DIALOUT_CONTEXT=${SIPPEER(${CALLER},context)})
        same => n,ExecIf($["${DIALOUT_CONTEXT}" = ""]?Set(DIALOUT_CONTEXT=common))
        same => n,Dial(Local/${NEW_CALLEE}@${DIALOUT_CONTEXT},,${DIAL_OPTIONS}g)
        same => n,ChannelRedirect(${CHANNEL(name)},nway-conf,${CONFNO},1)

[nway-conf]
exten => _X.,1,Answer
        same => n,Set(__CONFNO=${EXTEN})
        same => n,Noop(${CONFNO})
;       same => n,Set(DYNAMIC_FEATURES=${DYNAMIC_FEATURES_NWAY})
        same => n,Set(CONFBRIDGE(bridge,language)=${CHANNEL(language)})
        same => n,Set(CONFBRIDGE(user,announce_user_count)=no)
        same => n,Set(CONFBRIDGE(user,announce_join_leave)=no)
        same => n,Set(CONFBRIDGE(user,announce_only_user)=no)
        same => n,Set(CONFBRIDGE(user,music_on_hold_when_empty)=yes)
        same => n,ConfBridge(${CONFNO},,,nway_menu)
        same => n,Goto(nway-invite,s,1)

Вот по этой схеме http://voxlink.ru/kb/asterisk-configuration/callAsteriskConfBridge/

Так вот, если вызывающий абонент инициирует macro-nway-start, то все нормально

   --  Feature Found: nway-start exten: nway-start
        -- Executing [s@macro-nway-start:1] Set("SIP/2052-0000006c", "__CONFNO=1444137177.293") in new stack
        **-- Executing [s@macro-nway-start:2] ChannelRedirect("SIP/2052-0000006c", "SIP/2051-0000006d,nway-conf,1444137177.293,1") in new stack
        -- Executing [s@macro-nway-start:3] Read("SIP/2052-0000006c", "NEW_CALLEE,dial,20,i") in new stack
        -- Accepting a maximum of 20 digits.
        -- Executing [1444137177.293@nway-conf:1] Answer("SIP/2051-0000006d", "") in new stack
        -- Executing [1444137177.293@nway-conf:2] Set("SIP/2051-0000006d", "__CONFNO=1444137177.293") in new stack**
        -- Executing [1444137177.293@nway-conf:3] NoOp("SIP/2051-0000006d", "1444137177.293") in new stack
        -- Executing [1444137177.293@nway-conf:4] Set("SIP/2051-0000006d", "CONFBRIDGE(bridge,language)=ru") in new stack
        -- Executing [1444137177.293@nway-conf:5] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_user_count)=no") in new stack
        -- Executing [1444137177.293@nway-conf:6] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_join_leave)=no") in new stack
        -- Executing [1444137177.293@nway-conf:7] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_only_user)=no") in new stack
        -- Executing [1444137177.293@nway-conf:8] Set("SIP/2051-0000006d", "CONFBRIDGE(user,music_on_hold_when_empty)=yes") in new stack
        -- Executing [1444137177.293@nway-conf:9] ConfBridge("SIP/2051-0000006d", "1444137177.293,,,nway_menu") in new stack
        -- <SIP/2051-0000006d> Playing 'confbridge-join.alaw' (language 'ru')
        -- <Bridge/0x7f12b4000918-input> Playing 'confbridge-join.slin' (language 'ru')
        -- Started music on hold, class 'default', on SIP/2051-0000006d
        -- User entered nothing.
        -- Executing [s@macro-nway-start:4] Set("SIP/2052-0000006c", "DYNAMIC_FEATURES=nway-ok") in new stack
        -- Executing [s@macro-nway-start:5] NoOp("SIP/2052-0000006c", "") in new stack
        -- Executing [s@macro-nway-start:6] ExecIf("SIP/2052-0000006c", "1?Set(_DIAL_OPTIONS=H)") in new stack
        -- Executing [s@macro-nway-start:7] Set("SIP/2052-0000006c", "CALLER=2052") in new stack
        -- Executing [s@macro-nway-start:8] Set("SIP/2052-0000006c", "DIALOUT_CONTEXT=common") in new stack
        -- Executing [s@macro-nway-start:9] ExecIf("SIP/2052-0000006c", "0?Set(DIALOUT_CONTEXT=common)") in new stack
        -- Executing [s@macro-nway-start:10] Dial("SIP/2052-0000006c", "Local/@common,,Hg") in new stack
    [Oct  6 16:13:10] NOTICE[10639][C-0000005d]: chan_local.c:978 local_call: No such extension/context @common while calling Local channel
        -- Couldn't call Local/@common
      == Everyone is busy/congested at this time (0:0/0/0)
        -- Executing [s@macro-nway-start:11] ChannelRedirect("SIP/2052-0000006c", "SIP/2052-0000006c,nway-conf,1444137177.293,1") in new stack

А вот если вызываемый, то asterisk сначала ждет конца выполнения всего macro-nway-start, и только после этого запускает nway-conf.

--  Feature Found: nway-start exten: nway-start
    -- Executing [s@macro-nway-start:1] Set("SIP/2051-0000006f", "__CONFNO=1444137352.301") in new stack
    **-- Executing [s@macro-nway-start:2] ChannelRedirect("SIP/2051-0000006f", "SIP/2052-0000006e,nway-conf,1444137352.301,1") in new stack
    -- Executing [s@macro-nway-start:3] Read("SIP/2051-0000006f", "NEW_CALLEE,dial,20,i") in new stack
    -- Accepting a maximum of 20 digits.
    -- User entered nothing.
    -- Executing [s@macro-nway-start:4] Set("SIP/2051-0000006f", "DYNAMIC_FEATURES=nway-ok") in new stack
    -- Executing [s@macro-nway-start:5] NoOp("SIP/2051-0000006f", "") in new stack**
    -- Executing [s@macro-nway-start:6] ExecIf("SIP/2051-0000006f", "1?Set(_DIAL_OPTIONS=H)") in new stack
    -- Executing [s@macro-nway-start:7] Set("SIP/2051-0000006f", "CALLER=2051") in new stack
    -- Executing [s@macro-nway-start:8] Set("SIP/2051-0000006f", "DIALOUT_CONTEXT=common") in new stack
    -- Executing [s@macro-nway-start:9] ExecIf("SIP/2051-0000006f", "0?Set(DIALOUT_CONTEXT=common)") in new stack
    -- Executing [s@macro-nway-start:10] Dial("SIP/2051-0000006f", "Local/@common,,Hg") in new stack
[Oct  6 16:16:15] NOTICE[10676][C-0000005f]: chan_local.c:978 local_call: No such extension/context @common while calling Local channel
    -- Couldn't call Local/@common
  == Everyone is busy/congested at this time (0:0/0/0)
    -- Executing [s@macro-nway-start:11] ChannelRedirect("SIP/2051-0000006f", "SIP/2051-0000006f,nway-conf,1444137352.301,1") in new stack
    -- Executing [1444137352.301@nway-conf:1] Answer("SIP/2051-0000006f", "") in new stack
    -- Executing [1444137352.301@nway-conf:2] Set("SIP/2051-0000006f", "__CONFNO=1444137352.301") in new stack
    -- Executing [1444137352.301@nway-conf:3] NoOp("SIP/2051-0000006f", "1444137352.301") in new stack
    -- Executing [1444137352.301@nway-conf:4] Set("SIP/2051-0000006f", "CONFBRIDGE(bridge,language)=ru") in new stack
    -- Executing [1444137352.301@nway-conf:5] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_user_count)=no") in new stack
    -- Executing [1444137352.301@nway-conf:6] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_join_leave)=no") in new stack
    -- Executing [1444137352.301@nway-conf:7] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_only_user)=no") in new stack
    -- Executing [1444137352.301@nway-conf:8] Set("SIP/2051-0000006f", "CONFBRIDGE(user,music_on_hold_when_empty)=yes") in new stack
    -- Executing [1444137352.301@nway-conf:9] ConfBridge("SIP/2051-0000006f", "1444137352.301,,,nway_menu") in new stack
    -- <SIP/2051-0000006f> Playing 'confbridge-join.alaw' (language 'ru')

Почему меняется последовательность выполнения команд подскажите очень прошу

Read и ChannelRedirect Последовательность выполнения команд (n-way call)

Добрый день! Есть кусок диалплана, который используется для редиректа противоположной стороны разговора в динамическую конференц-комнату

[macro-nway-start]
exten => s,1,Set(__CONFNO=${UNIQUEID})
        same => n,ChannelRedirect(${BRIDGEPEER},nway-conf,${CONFNO},1)
        same => n,Read(NEW_CALLEE,dial,20,i)
        same => n,Set(DYNAMIC_FEATURES=${DYNAMIC_FEATURES_NWAYINV})
        same => n,Noop(${DIAL_OPTIONS})
        same => n,ExecIf($[${REGEX("H" ${DIAL_OPTIONS})} = 0]?Set(_DIAL_OPTIONS=${DIAL_OPTIONS}H))
        same => n,Set(CALLER=${CALLERID(num)})
        same => n,Set(DIALOUT_CONTEXT=${SIPPEER(${CALLER},context)})
        same => n,ExecIf($["${DIALOUT_CONTEXT}" = ""]?Set(DIALOUT_CONTEXT=common))
        same => n,Dial(Local/${NEW_CALLEE}@${DIALOUT_CONTEXT},,${DIAL_OPTIONS}g)
        same => n,ChannelRedirect(${CHANNEL(name)},nway-conf,${CONFNO},1)

[nway-conf]
exten => _X.,1,Answer
        same => n,Set(__CONFNO=${EXTEN})
        same => n,Noop(${CONFNO})
;       same => n,Set(DYNAMIC_FEATURES=${DYNAMIC_FEATURES_NWAY})
        same => n,Set(CONFBRIDGE(bridge,language)=${CHANNEL(language)})
        same => n,Set(CONFBRIDGE(user,announce_user_count)=no)
        same => n,Set(CONFBRIDGE(user,announce_join_leave)=no)
        same => n,Set(CONFBRIDGE(user,announce_only_user)=no)
        same => n,Set(CONFBRIDGE(user,music_on_hold_when_empty)=yes)
        same => n,ConfBridge(${CONFNO},,,nway_menu)
        same => n,Goto(nway-invite,s,1)

Вот по этой схеме http://voxlink.ru/kb/asterisk-configuration/callAsteriskConfBridge/

Так вот, если вызывающий абонент инициирует macro-nway-start, то все нормально

   --  Feature Found: nway-start exten: nway-start
        -- Executing [s@macro-nway-start:1] Set("SIP/2052-0000006c", "__CONFNO=1444137177.293") in new stack
        **-- Executing [s@macro-nway-start:2] ChannelRedirect("SIP/2052-0000006c", "SIP/2051-0000006d,nway-conf,1444137177.293,1") in new stack
        -- Executing [s@macro-nway-start:3] Read("SIP/2052-0000006c", "NEW_CALLEE,dial,20,i") in new stack
        -- Accepting a maximum of 20 digits.
        -- Executing [1444137177.293@nway-conf:1] Answer("SIP/2051-0000006d", "") in new stack
        -- Executing [1444137177.293@nway-conf:2] Set("SIP/2051-0000006d", "__CONFNO=1444137177.293") in new stack**
        -- Executing [1444137177.293@nway-conf:3] NoOp("SIP/2051-0000006d", "1444137177.293") in new stack
        -- Executing [1444137177.293@nway-conf:4] Set("SIP/2051-0000006d", "CONFBRIDGE(bridge,language)=ru") in new stack
        -- Executing [1444137177.293@nway-conf:5] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_user_count)=no") in new stack
        -- Executing [1444137177.293@nway-conf:6] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_join_leave)=no") in new stack
        -- Executing [1444137177.293@nway-conf:7] Set("SIP/2051-0000006d", "CONFBRIDGE(user,announce_only_user)=no") in new stack
        -- Executing [1444137177.293@nway-conf:8] Set("SIP/2051-0000006d", "CONFBRIDGE(user,music_on_hold_when_empty)=yes") in new stack
        -- Executing [1444137177.293@nway-conf:9] ConfBridge("SIP/2051-0000006d", "1444137177.293,,,nway_menu") in new stack
        -- <SIP/2051-0000006d> Playing 'confbridge-join.alaw' (language 'ru')
        -- <Bridge/0x7f12b4000918-input> Playing 'confbridge-join.slin' (language 'ru')
        -- Started music on hold, class 'default', on SIP/2051-0000006d
        -- User entered nothing.
        -- Executing [s@macro-nway-start:4] Set("SIP/2052-0000006c", "DYNAMIC_FEATURES=nway-ok") in new stack
        -- Executing [s@macro-nway-start:5] NoOp("SIP/2052-0000006c", "") in new stack
        -- Executing [s@macro-nway-start:6] ExecIf("SIP/2052-0000006c", "1?Set(_DIAL_OPTIONS=H)") in new stack
        -- Executing [s@macro-nway-start:7] Set("SIP/2052-0000006c", "CALLER=2052") in new stack
        -- Executing [s@macro-nway-start:8] Set("SIP/2052-0000006c", "DIALOUT_CONTEXT=common") in new stack
        -- Executing [s@macro-nway-start:9] ExecIf("SIP/2052-0000006c", "0?Set(DIALOUT_CONTEXT=common)") in new stack
        -- Executing [s@macro-nway-start:10] Dial("SIP/2052-0000006c", "Local/@common,,Hg") in new stack
    [Oct  6 16:13:10] NOTICE[10639][C-0000005d]: chan_local.c:978 local_call: No such extension/context @common while calling Local channel
        -- Couldn't call Local/@common
      == Everyone is busy/congested at this time (0:0/0/0)
        -- Executing [s@macro-nway-start:11] ChannelRedirect("SIP/2052-0000006c", "SIP/2052-0000006c,nway-conf,1444137177.293,1") in new stack

А вот если вызываемый, то asterisk сначала ждет конца выполнения всего macro-nway-start, и только после этого запускает nway-conf.

--  Feature Found: nway-start exten: nway-start
    -- Executing [s@macro-nway-start:1] Set("SIP/2051-0000006f", "__CONFNO=1444137352.301") in new stack
    **-- Executing [s@macro-nway-start:2] ChannelRedirect("SIP/2051-0000006f", "SIP/2052-0000006e,nway-conf,1444137352.301,1") in new stack
    -- Executing [s@macro-nway-start:3] Read("SIP/2051-0000006f", "NEW_CALLEE,dial,20,i") in new stack
    -- Accepting a maximum of 20 digits.
    -- User entered nothing.
    -- Executing [s@macro-nway-start:4] Set("SIP/2051-0000006f", "DYNAMIC_FEATURES=nway-ok") in new stack
    -- Executing [s@macro-nway-start:5] NoOp("SIP/2051-0000006f", "") in new stack**
    -- Executing [s@macro-nway-start:6] ExecIf("SIP/2051-0000006f", "1?Set(_DIAL_OPTIONS=H)") in new stack
    -- Executing [s@macro-nway-start:7] Set("SIP/2051-0000006f", "CALLER=2051") in new stack
    -- Executing [s@macro-nway-start:8] Set("SIP/2051-0000006f", "DIALOUT_CONTEXT=common") in new stack
    -- Executing [s@macro-nway-start:9] ExecIf("SIP/2051-0000006f", "0?Set(DIALOUT_CONTEXT=common)") in new stack
    -- Executing [s@macro-nway-start:10] Dial("SIP/2051-0000006f", "Local/@common,,Hg") in new stack
[Oct  6 16:16:15] NOTICE[10676][C-0000005f]: chan_local.c:978 local_call: No such extension/context @common while calling Local channel
    -- Couldn't call Local/@common
  == Everyone is busy/congested at this time (0:0/0/0)
    -- Executing [s@macro-nway-start:11] ChannelRedirect("SIP/2051-0000006f", "SIP/2051-0000006f,nway-conf,1444137352.301,1") in new stack
    -- Executing [1444137352.301@nway-conf:1] Answer("SIP/2051-0000006f", "") in new stack
    -- Executing [1444137352.301@nway-conf:2] Set("SIP/2051-0000006f", "__CONFNO=1444137352.301") in new stack
    -- Executing [1444137352.301@nway-conf:3] NoOp("SIP/2051-0000006f", "1444137352.301") in new stack
    -- Executing [1444137352.301@nway-conf:4] Set("SIP/2051-0000006f", "CONFBRIDGE(bridge,language)=ru") in new stack
    -- Executing [1444137352.301@nway-conf:5] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_user_count)=no") in new stack
    -- Executing [1444137352.301@nway-conf:6] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_join_leave)=no") in new stack
    -- Executing [1444137352.301@nway-conf:7] Set("SIP/2051-0000006f", "CONFBRIDGE(user,announce_only_user)=no") in new stack
    -- Executing [1444137352.301@nway-conf:8] Set("SIP/2051-0000006f", "CONFBRIDGE(user,music_on_hold_when_empty)=yes") in new stack
    -- Executing [1444137352.301@nway-conf:9] ConfBridge("SIP/2051-0000006f", "1444137352.301,,,nway_menu") in new stack
    -- <SIP/2051-0000006f> Playing 'confbridge-join.alaw' (language 'ru')

Почему меняется последовательность выполнения команд подскажите очень прошу

Проект компании "АТС Дизайн"
Asterisk® и Digium® являются зарегистрированными торговыми марками компании Digium, Inc., США.
IP АТС Asterisk распространяется под лицензией GNU GPL.