8000 Skills: Cancel dialogs only if EOC is coming from parent. (#860) · il-null-yuyi/botbuilder-python@7e2fbad · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e2fbad

Browse files
Skills: Cancel dialogs only if EOC is coming from parent. (microsoft#860)
* Skills: Cancel dialogs only if EOC is coming from parent. * Updating __is_eoc_coming_from_parent condition * modify activity.caller_id in bfhttpclient Co-authored-by: Axel Suárez <axsuarez@microsoft.com>
1 parent d282ea3 commit 7e2fbad

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ async def run_dialog(
3030
if (
3131
turn_context.activity.type == ActivityTypes.end_of_conversation
3232
and dialog_context.stack
33+
and DialogExtensions.__is_eoc_coming_from_parent(turn_context)
3334
):
35+
remote_cancel_text = "Skill was canceled through an EndOfConversation activity from the parent."
36+
await turn_context.send_trace_activity(
37+
f"Extension {Dialog.__name__}.run_dialog", label=remote_cancel_text,
38+
)
39+
3440
await dialog_context.cancel_all_dialogs()
3541
else:
3642
# Process a reprompt event sent from the parent.
@@ -75,3 +81,9 @@ async def run_dialog(
7581
results = await dialog_context.continue_dialog()
7682
if results.status == DialogTurnStatus.Empty:
7783
await dialog_context.begin_dialog(dialog.id)
84+
85+
@staticmethod
86+
def __is_eoc_coming_from_parent(turn_context: TurnContext) -> bool:
87+
# To determine the direction we check callerId property which is set to the parent bot
88+
# by the BotFrameworkHttpClient on outgoing requests.
89+
return bool(turn_context.activity.caller_id)

libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/bot_framework_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def post_activity(
9797
)
9898
activity.conversation.id = conversation_id
9999
activity.service_url = service_url
100-
activity.caller_id = from_bot_id
100+
activity.caller_id = f"urn:botframework:aadappid:{from_bot_id}"
101101

102102
headers_dict = {
103103
"Content-type": "application/json; charset=utf-8",

0 commit comments 309A

Comments
 (0)
0