Merge pull request #252 from outis1one/claude/asterisk-caller-id-number-y1b3ls

Claude/asterisk caller id number y1b3ls
This commit is contained in:
Outis
2026-07-27 08:56:54 -04:00
committed by GitHub
+16 -7
View File
@@ -333,12 +333,21 @@ def _ami_read_response(sock_file):
def ami_deliver(from_number, to_exts, body): def ami_deliver(from_number, to_exts, body):
"""Logs into AMI once and sends one MessageSend action per recipient. """Logs into AMI once and sends one MessageSend action per recipient.
UNVERIFIED against a real Asterisk instance as of this being written — "message" as the AMI permission class is confirmed live (login succeeds).
"message" as the AMI permission class, and To/From/Body as MessageSend's Destination (not To) is what actually resolves an outgoing message's
exact parameter names, are both believed correct but haven't been endpoint/technology -- confirmed against this box's own
confirmed live. Every AMI response is logged in full specifically so the `manager show command MessageSend`: To alone is documented as a
first real delivery attempt shows exactly what Asterisk said if backward-compatible fallback for the destination, but live testing
something here is wrong, rather than failing silently. (bare "pjsip:212", then "pjsip:212@domain", both for To with no
Destination) produced zero SIP wire traffic in either case -- `pjsip
set logger on` during a real attempt showed Asterisk never even tried
reaching the target's registered contact, so that fallback path isn't
actually wired up on this Asterisk version regardless of what the docs
promise. Destination's documented "endpoint" form -- bare "pjsip:<ext>",
no domain -- resolves via the endpoint's own default aor/contact, which
is exactly the live, registered contact `pjsip show contacts` already
confirmed exists. Every AMI response is still logged in full so the
next attempt is self-diagnosing if this isn't the whole fix either.
Returns (delivered_count, total_count).""" Returns (delivered_count, total_count)."""
if not AMI_SECRET: if not AMI_SECRET:
@@ -369,7 +378,7 @@ def ami_deliver(from_number, to_exts, body):
for ext in to_exts: for ext in to_exts:
resp = send_action([ resp = send_action([
("Action", "MessageSend"), ("Action", "MessageSend"),
("To", "pjsip:{}".format(ext)), ("Destination", "pjsip:{}".format(ext)),
("From", from_uri), ("From", from_uri),
("Body", body), ("Body", body),
]) ])