diff --git a/CHANGELOG.md b/CHANGELOG.md index c3c79d695..7b731a77b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Phone Systems: Admin > Phone Systems takes FusionPBX - without its API or its database. FreeSWITCH, underneath it, sends ITFlow each call's record as it hangs up and asks ITFlow for caller ID names; the system's Setup window gives the lines to paste, with its own key in them. Each of its domains is linked to the client it is, with the client it looks like suggested. A call on a client's domain is that client's; on your own company's domain it goes to whoever called, from any client. - Calls: a new Calls page, on the menu and on each client, lists the calls with who they were with - matched to a contact by their number, or to a client by its main number - the extension and agent that took them, how long they talked, and whether they were missed or went to voicemail, with a link to the call's page in FusionPBX and its recording. A contact's page has a Calls tab, and the menu counts the calls missed today that aren't on a ticket. Add to Ticket puts a call on one of the client's open tickets, or a new one, as an internal note with its talk time as time worked. - Phone Systems: as a call rings, desk phones show the contact and their client - Marla Whitfield - Ravenwood Dental - when ITFlow knows the number, and the carrier's name otherwise. +- Phone Systems: Yealink and Polycom desk phones report themselves as they start up and register - the Setup window has the lines for each - and become Phone assets of their domain's client, named after their extension, with their make, model, firmware, IP and MAC address. A client's asset that already has the phone's MAC address is used instead. The asset keeps up with new firmware and IP addresses, except for fields changed in ITFlow, and has a card saying whether the phone is registered and its line. The Domains page counts each domain's phones. ### Bug Fixes @@ -56,6 +57,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Database 4.1.4: `phone_systems`, `phone_domains`, `phone_calls`, `phone_devices`, `phone_events` and `user_settings.user_config_phone_line`. Re-runnable. `functions/phone.php` has them; nothing in ITFlow connects to a phone system - it sends to `api/phone/`, keyed by the address's `key` or the HTTP Basic password (`phoneSystemByKey()`), 404 for an unknown key and 503 for a system turned off. - `api/phone/cdr.php` takes mod_xml_cdr's post - the `cdr` field URL-encoded or base64, or the body - through `phoneCdrParse()` (its variables URL-decoded, the rest from the first caller profile) and `phoneCallFromCdr()` (FusionPBX's `call_direction`, else worked out from the numbers). A second leg (`originating_leg_uuid`, or `uuid` starting `b_`) is set aside, and a call is kept once per uuid. `api/phone/cid.php` answers mod_cidlookup with `phoneCallerName()`. - `phoneWho($number, $domain_client_id)` matches a number with `smsContactsFor()` - a mobile before an office number many share - then clients' location phones; a number more than one client has is nobody's. On a client's domain only that client counts; on your own company's (`config_internal_client_id`) or one not linked, every client does. `phoneDomainLink()` matches a domain's calls again. `phoneCallToTicket()` adds the internal note, its talk time as `ticket_reply_time_worked` with the work start and end, and `add_ticket` takes `phone_call_id` (ticket source Phone). `phoneCleanup()` runs nightly: calls over 400 days old that aren't on a ticket go. Client delete and merge take the phone tables. +- `api/phone/hook.php` takes desk phones' events through `phoneHookEvent()` - Yealink action URLs as GET (`e` = setup, registered, unregistered, failed, ringing, outgoing, answered or ended, with `mac`, `ip`, `model`, `fw`, `line`, `domain`, `number`, `name` and `call`; a variable the phone left unfilled counts as nothing) or Polycom telephony notifications posted as XML (`phoneHookPolycom()`), with the vendor, model and firmware from the User-Agent when the request doesn't say. `phoneDeviceSave()` keeps a phone by system and MAC in `phone_devices`, and `phoneDeviceAsset()` finds the client's asset by MAC (`asset_interfaces.interface_mac`, any separators) or makes a Phone asset with its interface and `extension` detail, then follows the phone the way RMM devices do: a field is written when empty or still what the phone said last. `phone_device_asset_id` -1 is an asset deleted in ITFlow, not made again. `phoneDomainLink()` runs it for the domain's phones. ## [26.12] diff --git a/admin/modals/phone/phone_system_setup.php b/admin/modals/phone/phone_system_setup.php index 91740bf67..af109accc 100644 --- a/admin/modals/phone/phone_system_setup.php +++ b/admin/modals/phone/phone_system_setup.php @@ -24,10 +24,30 @@ $xml = function (string $url) { }; $cdr_url = phoneUrl($row, 'cdr'); $cid_url = phoneUrl($row, 'cid', 'number=${caller_id_number}&domain=${domain_name}'); +$hook_url = phoneUrl($row, 'hook'); + +// Yealink action URLs - the phone fills in its own $variables +$account = 'line=$active_user&domain=$active_host'; +$yealink = [ + 'setup_completed' => 'e=setup&mac=$mac&ip=$ip&model=$model&fw=$firmware', + 'registered' => "e=registered&mac=\$mac&ip=\$ip&model=\$model&fw=\$firmware&$account", + 'unregistered' => "e=unregistered&mac=\$mac&$account", + 'register_failed' => "e=failed&mac=\$mac&$account", + 'incoming_call' => "e=ringing&mac=\$mac&$account&number=\$remote&name=\$display_remote&call=\$call_id", + 'outgoing_call' => "e=outgoing&mac=\$mac&$account&number=\$remote&name=\$display_remote&call=\$call_id", + 'call_established' => "e=answered&mac=\$mac&$account&number=\$remote&call=\$call_id", + 'call_terminated' => "e=ended&mac=\$mac&$account&number=\$remote&call=\$call_id", +]; +$yealink_lines = []; +foreach ($yealink as $event => $query) { + $yealink_lines[] = "action_url.$event = $hook_url&$query"; +} $snippets = [ 'cdr' => '\n\n\n", 'cid' => '\n", + 'yealink' => implode("\n", $yealink_lines), + 'polycom' => '", 'dialplan' => "\n \n \n \n \n \n \n", ]; @@ -68,6 +88,12 @@ ob_start();

Load it with fs_cli -x 'reload mod_cidlookup' (add mod_cidlookup to modules.conf.xml if it isn't). Then, in Dialplan > Dialplan Manager, add this to the public context, ordered before the inbound routes - the name is only set when ITFlow knows the number, so the carrier's stays otherwise:

+
Phones
+

Desk phones tell ITFlow their model, firmware, IP address and line as they start up and register, and each becomes a Phone asset of its domain's client, kept by its MAC address. They reach ITFlow themselves, so they need to be able to get to its address. For Yealink phones, add these lines to the template provisions them with and have the phones check for new settings - or, for one phone, enter each address in its web page under Features > Action URL:

+ +

For Polycom phones, add this to the configuration they are provisioned with:

+ +