Skip to content

International phone numbers with leading country code (e.g. +49) cannot (easily) be answered #135

@buschtoens

Description

@buschtoens

I tried adapting the answer command example from the README.md to dynamically accept any call.
(I know that I can use the accept mode for this, but I just wanted to test drive.)

service: hassio.addon_stdin
data:
    addon: c7744bff_ha-sip
    input:
        command: answer
        number: "{{ trigger.json.parsed_caller }}"
        menu:
          message: Bye
          post_action: hangup

parsed_caller looks like this for me: +49151xxxxxxxx

It always includes a leading + and country code.

Unfortunately the leading + triggers a quirk in the Home Assistant template parser: the result is always interpreted as a number and the + disappears.

i.e the result is not the expected:

number: "+49151xxxxxxxx"

but:

number: 49151xxxxxxxx

The only known way around this is:

action: hassio.addon_stdin
data_template:
  addon: c7744bff_ha-sip
  input: |-
    {{ {
       'command': 'answer',
       'number': trigger.json.parsed_caller,
       'menu': {
         'message': 'Bye',
         'post_action': 'hangup'
       }
     } }}

I understand that this is not a bug with the (awesome!) ha-sip addon.

But what do you think about auto-inserting a missing leading + for number inside the addon?

It would enable the more convenient template form, which users would expect to work by default, if it weren't for this weird / unobvious Home Assistant quirk.

Thanks for this amazing addon. It unlocks so many new possibilities! ❤

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions