Orchard Core Telephony - Prompt Templates
Configure Provider-Agnostic Telephony
You are an Orchard Core expert. Generate accurate code, configuration, recipes, and administration guidance for the CrestApps Telephony module. It supplies a provider-neutral call-control layer, a SignalR hub, call history, an internal extension registry, encrypted recording storage, and an optional floating soft phone. It does not provide SMS; use Orchard Core SMS (orchardcore-sms) or the Omnichannel skills for text messaging.
In this module, provider means the telephony backend adapter (Telnyx, Asterisk, or a custom PBX or carrier integration), not the phone company in the billing sense.
Guidelines
- Install
CrestApps.OrchardCore.Telephony(and any provider package) in the web/startup project. - Enable
CrestApps.OrchardCore.Telephonyfor the runtime services, the hub, call history, extensions, and the Settings → Communication → Telephony screen. There is no separate administration feature in 3.0. - The core feature depends on
OrchardCore.UsersandOrchardCore.SignalR(the Orchard Core framework SignalR module; seeorchardcore-signalr), plusCrestApps.OrchardCore.UsersandCrestApps.OrchardCore.Resourcesfor the searchable user picker in the extension editor. - To push to a user's soft phones from another module, inject
ISoftPhoneClientNotifier(CallStateChangedAsync,IncomingCallAnsweredAsync,DialRequestedAsync, inCrestApps.OrchardCore.Telephony.Abstractions) instead of usingTelephonyHub.SoftPhoneWidgetSettingsis in the same package. - Enable
CrestApps.OrchardCore.Telephony.SoftPhoneonly when the floating widget or the front-end Soft Phone widget is needed. EnableCrestApps.OrchardCore.Telephony.SoftPhone.Extensionfor the standalone/softphonepage used by the browser extension and desktop app. - Enable a provider feature (
orchardcore-telephony-telnyx,orchardcore-telephony-asterisk, or your own) and select it as the default provider. - Call
ITelephonyServicefrom application code; never call a provider directly, because the service enforces capability, contract, and dial-destination checks. - Implement
ITelephonyProviderplus only the capability contracts the backend really supports, and advertise exactly thoseTelephonyCapabilities. - Read
TelephonyProviderOptionsthroughIOptionsMonitor<TelephonyProviderOptions>and callIOptionsUpdateNotifier.RequestUpdate<TelephonyProviderOptions>()after a provider's settings change. - Keep provider credentials and user tokens server-side; never send an API key or OAuth refresh token to browser code.
- Map hubs with
SignalRHubRoutes.GetHubPath<T>()and generate client URLs withHtml.SignalRHubUrl<T>();HubRouteManagerno longer exists. - All recipe JSON must be wrapped in
{ "steps": [...] }. - All C# classes must use the
sealedmodifier, except for View Models.
Feature Overview
| Feature | Feature ID | Purpose |
|---|---|---|
| Telephony | CrestApps.OrchardCore.Telephony | Provider resolver, services, TelephonyHub, OAuth routes, settings screen and menu, call history, extension registry, recording store |
| Telephony Soft Phone Core | CrestApps.OrchardCore.Telephony.SoftPhone.Core | Shared soft phone presenter, resources and softphone/dial endpoint. Enabled by dependency only |
| Telephony Soft Phone | CrestApps.OrchardCore.Telephony.SoftPhone | Floating soft phone on admin pages plus a placeable Soft Phone widget. Depends on OrchardCore.Widgets |
| Telephony Soft Phone Extension | CrestApps.OrchardCore.Telephony.SoftPhone.Extension | Standalone /softphone page and GET /softphone/extension-config for the CrestApps Soft Phone browser extension and desktop app |
| Telephony - Azure Blob Storage | CrestApps.OrchardCore.Telephony.Azure | Stores the encrypted recording and voice-media store in Azure Blob Storage. See references/recording-storage.md |
Declare a dependency on Telephony with TelephonyConstants.Feature.Area.
Enable the Features
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Telephony",
"CrestApps.OrchardCore.Telephony.SoftPhone"
],
"disable": []
}
]
}
Architecture
Browser command --SignalR--> TelephonyHub --> ITelephonyService --> ITelephonyProviderResolver --> provider
Provider webhook or stream --> ProviderVoiceEvent --> INormalizedVoiceEventIngestor --> handlers
|
+--> CallStateChanged pushed to the soft phone
CrestApps.OrchardCore.Telephony.Abstractionsholds the provider contracts, request and result models,TelephonyProviderOptions,TelephonySettings,TelephonyPermissions, andTelephonyConstants. A provider module depends only on this package (plusCrestApps.OrchardCore.ContactCenter.Abstractionswhen it adapts Contact Center).CrestApps.OrchardCore.Telephony.Coreholds the normalized voice-event pipeline (INormalizedVoiceEventIngestor,INormalizedVoiceEventHandler), the extension registry services, and the default dial and transfer policies.- Command results only acknowledge a request. Live state comes from provider events normalized into
ProviderVoiceEvent, so the server stays the source of truth.
The Provider Contract
ITelephonyProvider declares only Name (a LocalizedString) and Capabilities. Each operation lives on its own contract. TelephonyCapabilityContracts maps every flag to the contract that must back it, and DefaultTelephonyService refuses an operation unless the provider both advertises the flag and implements the contract.
| Capability | Contract | Methods |
|---|---|---|
| Dial, Hangup | ITelephonyCallControlProvider | DialAsync, HangupAsync |
| ReceiveCalls | ITelephonyInboundCallProvider | AnswerAsync, RejectAsync |
| Hold, Resume | ITelephonyHoldProvider | HoldAsync, ResumeAsync |
| Mute | ITelephonyMuteProvider | MuteAsync, UnmuteAsync |
| Transfer | ITelephonyTransferProvider | TransferAsync |
| AttendedTransfer | ITelephonyAttendedTransferProvider | StartAttendedTransferAsync |
| Merge | ITelephonyConferenceProvider | MergeAsync |
| SendDigits | ITelephonyDtmfProvider | SendDigitsAsync |
| Voicemail | ITelephonyVoicemailProvider | SendToVoicemailAsync |
| Directory | ITelephonyDirectoryProvider | GetDirectoryAsync |
| ExtensionDial, ExtensionConference | ITelephonyExtensionDialProvider | DialExtensionAsync, AddExtensionToConferenceAsync |
| BridgedDial | ITelephonyCallControlProvider | DialAsync with RequestMetadata.SoftPhoneCredentialId set |
Optional contracts that are not capability-gated:
| Contract | Purpose |
|---|---|
| ITelephonySoftPhoneCredentialsProvider | GetClientCredentialsAsync issues browser bootstrap credentials |
| ITelephonyCallStateProvider | GetCallStateAsync reports provider-authoritative call state for reconciliation |
| ITelephonyAudioProvider | AudioCapabilities (Browser, ExternalDevice), ConfiguredAudioMode, BrowserMediaAdapterName |
| ITelephonyConsultTransferProvider | GetConsultAsync, CompleteConsultAsync, CancelConsultAsync for a transfer carried out as a consult call |
| ITelephonyAuthenticationProvider | Per-user OAuth for providers that need it (the built-in providers do not) |
Every operation returns TelephonyResult with Succeeded, OutcomeUnknown, Error, ErrorCode, and Call. Use TelephonyResult.Unknown(...) when a provider cannot confirm the outcome (for example a timeout after the request was sent) so callers never retry an operation that may have succeeded.
For the full provider walkthrough, event normalization rules, and transport models, see references/custom-providers.md.
Site Settings
Settings live under Settings → Communication → Telephony (group TelephonyConstants.SettingsGroupId, value telephony) and require ManageTelephonySettings. The Soft Phone tab selects the default provider and lists Allowed short codes; every enabled provider adds its own tab through a SiteDisplayDriver<TSettings> whose SettingsGroupId is TelephonyConstants.SettingsGroupId.
- Enabling the only configured provider makes it the default. Disabling the default provider clears
TelephonySettings.DefaultProviderNameand the soft phone is disabled until a new default is chosen. - The Costs tab (
TelephonyCostSettingsinCrestApps.OrchardCore.Telephony.Abstractions:Currency, defaultUSD, andPerMinute, the carrier's price of a phone-call minute) feeds the AI voice usage report's per-call cost estimate: the call's minutes at this price plus the AI deployment's prices. It replaces the removed Costs card andAICostSettingsof Settings → Artificial Intelligence; a Telephony migration moves an existing per-minute price and currency once. There is no per-text price. - Settings export through the Telephony Settings and Soft Phone Widget Settings deployment steps and import through the built-in
Settingsrecipe step. Provider credentials travel through each provider's own step. No deployment step exportsTelephonyCostSettings; set it with theSettingsstep, which stores any named site setting.
{
"steps": [
{
"name": "Settings",
"TelephonySettings": {
"DefaultProviderName": "Telnyx",
"AllowedShortCodes": ["611"]
},
"TelephonyCostSettings": {
"Currency": "USD",
"PerMinute": 0.012
},
"SoftPhoneWidgetSettings": {
"Enabled": true,
"DisplayOnAdmin": true,
"EnableDiagnostics": false,
"AccentColor": "#2f6fed",
"RecentCallsCount": 30,
"DefaultCountryCode": "US"
}
}
]
}
Dial Destination Safety
Every dial and transfer path (keypad, transfer field, extension field, Contact Center dial and transfer) is checked by IDialDestinationPolicy.Evaluate(address, DialDestinationContext) before a provider is reached. The default policy refuses emergency short codes (911, 112, 999, 000 and others), premium-rate prefixes (1900, 1976, 4470), and anything that is neither a dialable international number nor an allowed short code. Allowed short codes can never open an emergency code. This is a refusal to originate, not an emergency-calling capability.
ITransferTargetPolicy decides what an agent may transfer to. Contact Center Voice replaces it with a curated-destination policy, and replaces IOutboundLineResolver so each user dials out from an assigned line (see orchardcore-contact-center).
Soft Phone
With CrestApps.OrchardCore.Telephony.SoftPhone enabled, the Soft Phone tab configures SoftPhoneWidgetSettings:
| Setting | Property | Default |
|---|---|---|
| Enable the soft phone (kill switch) | Enabled | true |
| Show on the admin dashboard | DisplayOnAdmin | true |
| Enable the diagnostics tab | EnableDiagnostics | false (or add ?diag=1 to a URL for one session) |
| Default country | DefaultCountryCode | Automatic (culture, then browser locale, then United States) |
| Accent color | AccentColor | #2f6fed |
| Recent calls to display | RecentCallsCount | 30 (1 to 200) |
- The widget renders only for users with
UseTelephonySoftPhone(display name "Use the telephony soft phone"). - Admin pages get the widget in the
Footerzone automatically. For the front end, add the Soft Phone widget from Design → Widgets, optionally on an authenticated layer. - To render it in a theme without a widget, render the
SoftPhoneWidgetshape throughIDisplayManager<SoftPhoneWidget>and register the resources.telephony-soft-phonedepends onsignalr,telephony-client, andintl-tel-input, so ResourceManager resolves them.
<style asp-name="telephony-soft-phone" at="Head"></style>
<script asp-name="telephony-soft-phone" at="Foot"></script>
<script asp-name="telephony-phone-field" at="Foot"></script>
- The keypad normalizes a valid national number to E.164 using intl-tel-input so outbound compliance screening (
orchardcore-dnc-registry,orchardcore-phone-numbers) sees a canonical number. The Dial extension toggle sendsDialRequest.IsExtensionand skips that screening. - The Phone Field editor and display expose a
data-phone-dialplaceholder; the soft phone attaches a Call with the soft phone button that posts tosoftphone/dial. A call started there is a manual call, screened by the Contact Center Dialer'sIOutboundCallScreener(do-not-call, unreadable numbers, an optional manual calling window) when Contact Center is enabled. With the Extension feature,SoftPhoneExtensionDialerFilterenables the button on admin pages and the hub sendsDialRequestedto the standalone phone. - Modules add footer tabs with a
DisplayDriver<SoftPhoneWidget>; Contact Center adds the Work tab this way. - The phone rings for one incoming call at a time: a new leg is declined while another call rings or the agent is on a call (unless the agent is answering, when a late leg of that call may arrive), and a Contact Center offer declines a different leg still ringing. Each platform leg is tied to the first call reported live on it, so a call-ended report or an empty active-calls refresh hangs up only the leg of the call it names; the diagnostics tab reports
platform-leg-hangupwhen the server ends a leg. - Browser audio providers register
window.telephonySoftPhone.mediaAdapters[adapterName]; the server provider must implementITelephonyAudioProvider, advertiseBrowser, and return the sameBrowserMediaAdapterName.
Hub and Client Events
TelephonyHub authorizes every method against UseTelephonySoftPhone and joins a tenant-qualified user group. Main methods include Dial, Hangup, Hold, Resume, Mute, Unmute, Transfer, Merge, SendDigits, Answer, Reject, Voicemail, DialExtension, AddExtensionToConference, GetConsult, CompleteConsult, CancelConsult, GetActiveCall, GetActiveCalls, GetInteractions, GetExtensionDirectory, GetDirectory, GetCapabilities, GetCredentials, and GetConnectionStatus.
ITelephonyClient pushes CallStateChanged, IncomingCall, IncomingCallAnswered, CredentialsIssued, RemotePartyChanged, DialRequested, and ReceiveError. Providers report ringback state through ITelephonyRemotePartyNotifier.NotifyAsync(providerName, providerCallId, RemotePartyState), which drives the RemotePartyChanged message and the soft phone's ringback tone.
Incoming Calls
Telephony owns the incoming-call modal and media controls; it does not decide who receives a call. An orchestration module resolves the user and calls IIncomingCallDispatcher.DispatchAsync(userId, call). Other modules add cards to the modal with IIncomingCallContextProvider:
using CrestApps.OrchardCore.Telephony;
using CrestApps.OrchardCore.Telephony.Models;
namespace MyCompany.OrchardCore.Crm;
public sealed class CustomerIncomingCallContextProvider : IIncomingCallContextProvider
{
public Task ContributeAsync(IncomingCallContributionContext context, CancellationToken cancellationToken = default)
{
context.Cards.Add(new IncomingCallCard
{
Title = "Jane Doe",
Subtitle = context.Call.From,
Icon = "fa-solid fa-user",
Url = "/Admin/Contents/ContentItems/4k9.../Edit",
});
return Task.CompletedTask;
}
}
Register it with services.AddScoped<IIncomingCallContextProvider, CustomerIncomingCallContextProvider>(). Each card renders Answer & open and Open actions. Setting context.Properties["acceptUrl"] and context.Properties["declineUrl"] makes the modal post to those URLs as the agent answers or ignores the call.
Call History
TelephonyCallHistoryVoiceEventHandler and the hub persist every call through ITelephonyInteractionStore, indexed by TelephonyInteractionIndex (provider interaction id, provider name, user, direction, outcome, timestamps, duration). History survives removal of a provider. Updates use optimistic concurrency. Active-call restoration calls GetActiveCalls, which validates each in-progress record against ITelephonyCallStateProvider and deletes confirmed orphans.
Extensions
The tenant-scoped extension registry maps a dialed number to an Orchard user, managed under Interaction Center → Management → Extensions when Contact Center is enabled, otherwise Settings → Communication → Extensions, with ManageTelephonyExtensions. With CrestApps.OrchardCore.Staff enabled, the staff editor shows a Phone card and a person who leaves has their extension freed (TelephonyStaffLifecycleObserver, see orchardcore-staff). The editor picks the user with the searchable user picker, which searches on the server instead of listing every user. The list is an Orchard Core AdminList named TelephonyExtensions with Name, Number, and User grid columns, so other modules can add columns through IAdminListColumnsProvider (see orchardcore-admin-lists). Extensions import through the TelephonyExtension recipe step. Details, the provider contract, and the recipe shape are in references/extension-dialing.md.
Recording Storage
IRecordingMediaStore holds Contact Center call recordings and voice-media master copies, encrypted with the tenant data-protection key, by default under App_Data/Sites/{tenant}/RecordingMedia. Writes stream from RecordingMediaWriteRequest.Content (a Stream); OpenReadAsync returns a seekable decrypting stream. Enable CrestApps.OrchardCore.Telephony.Azure to move the ciphertext to Azure Blob Storage. See references/recording-storage.md.
Configuration Sections
| Section | Keys |
|---|---|
| CrestApps_Telephony:Commands | Timeout (default 00:00:10, 1 second to 2 minutes). The deadline for one PBX command |
| CrestApps_Telephony:Coordination | InteractionLockTimeout (00:00:05), InteractionLockExpiration (00:02:00), NewInteractionGracePeriod (00:00:15), ClientRecordedCallMaxAge (04:00:00), ClientRecordedCallSilenceTimeout (00:05:00), TokenRefreshLockTimeout (00:00:10), TokenRefreshLockExpiration (00:01:00) |
| CrestApps:Telephony:AzureRecordings | ConnectionString, ContainerName, BasePath, CreateContainer |
{
"OrchardCore": {
"CrestApps_Telephony": {
"Commands": {
"Timeout": "00:00:15"
},
"Coordination": {
"InteractionLockTimeout": "00:00:10"
}
}
}
}
Environment variables keep the single underscore, for example OrchardCore__CrestApps_Telephony__Commands__Timeout=00:00:15. Options are validated on tenant activation, and each lease expiration must exceed its lock timeout.
Monitoring
TelephonyTelemetry publishes the meter and activity source CrestApps.OrchardCore.Telephony (matched by CrestApps.OrchardCore.*, see orchardcore-opentelemetry and orchardcore-observability) for every provider:
| Instrument | Tags | Measures |
|---|---|---|
| crestapps.telephony.command.duration | command, provider, outcome (ok, error, timeout, cancelled, not_admitted), reason, error.type | One provider mutation run by DefaultTelephonyCommandExecutor |
| crestapps.telephony.dial.screenings | stage (destination_policy, compliance), result, reason | Soft-phone dials screened |
| crestapps.telephony.softphone.credentials | provider, operation (issue, revoke), outcome | Browser SIP credentials |
| crestapps.telephony.reconcile.corrections | provider, action | Orphaned calls ended by a sweep; any steady rate means lost events |
| crestapps.telephony.recording.ingest.duration, .lag, .backlog_age | provider, result | Recording ingest jobs |
| crestapps.telephony.voice_event.discards | provider, reason | Stale or out-of-order provider voice events |
Spans: crestapps.telephony.command, crestapps.telephony.recording.ingest. No metric carries a call id, phone number or SIP URI. Pass the provider to the ITelephonyCommandExecutor.ExecuteAsync(providerName, command, operation) overload so commands are tagged; the old overload records command = unknown.
Permissions
| Permission | Name | Use |
|---|---|---|
| TelephonyPermissions.ManageTelephonySettings | ManageTelephonySettings | Telephony settings screen and every provider tab |
| TelephonyPermissions.UseSoftPhone | UseTelephonySoftPhone | Soft phone widget, hub, /softphone page |
| TelephonyPermissions.ManageExtensions | ManageTelephonyExtensions | Extension registry |
Upgrading from 2.x
- Remove
CrestApps.OrchardCore.Telephony.Adminfrom recipes and deployment plans; the settings screen and menu are part ofCrestApps.OrchardCore.Telephony.TelephonyConstants.Feature.Admin,TelephonyAdminStartup, andAsteriskAdminStartupare removed; depend onTelephonyConstants.Feature.Area. - The Dialpad provider (
CrestApps.OrchardCore.Dialpad) is removed. Move to Telnyx (orchardcore-telephony-telnyx), Asterisk (orchardcore-telephony-asterisk), or a custom provider, and updateTelephonySettings.DefaultProviderName. - Read
TelephonyProviderOptions(andTelnyxOptions) throughIOptionsMonitor<T>.CurrentValueorIOptionsSnapshot<T>.IOptions<T>keeps the first value and never sees a settings change. Custom providers callIOptionsUpdateNotifier.RequestUpdate<TelephonyProviderOptions>()after saving settings. ITelephonyAuthenticationProvider.RevokeTokensAsyncandITelephonyAuthenticationService.DisconnectAsyncreturnTask<TelephonyResult>.RecordingMediaWriteRequest.Contentis aStream, notbyte[];InteractionIdisnullfor voice-media master copies.- Custom
ITelephonyUserAccessorimplementations addReloadCurrentUserAsync()andPersistCurrentUserAsync(Func<IUser, bool> mutate). IVoiceMediaProvisionergainsGetAvailabilityAsync(mediaReference, cancellationToken)returningVoiceMediaAvailability; the default answersUnknown, so override it to let a lost provider copy be re-uploaded from the master copy.- The CrestApps SignalR module is deprecated in favor of
OrchardCore.SignalR; replaceHubRouteManagerwithSignalRHubRoutes.GetHubPath<T>()andHtml.SignalRHubUrl<T>(). - The extension list renders through the Orchard Core
AdminListshape; whole-row template overrides only apply to the List layout. UseSummaryAdminGridplacement for the Grid layout. - Modules that pushed to
TelephonyHubclients directly should callISoftPhoneClientNotifier; readSoftPhoneWidgetSettingsfromCrestApps.OrchardCore.Telephony.Abstractionsrather than the Telephony module. - Admin edit forms render their buttons in Orchard Core's sticky bottom action bar (
<div class="action-bar-bottom">): Cancel first, secondary actions next, the primary Save last. Theme overrides or UI tests that look for the oldocat-wrapperbutton row must update. AICostSettingswas removed from the AI module; read the carrier price fromTelephonyCostSettings(site.GetOrCreate<TelephonyCostSettings>()).AICallMetrics.EstimateCosttakes the per-minute price and its currency instead of a settings object.
Troubleshooting
| Symptom | Check |
|---|---|
| Widget says no provider is configured | Enable a provider, configure it, and select it as the default on the Soft Phone tab |
| Widget never renders | Enable CrestApps.OrchardCore.Telephony.SoftPhone, keep Enable the soft phone on, and grant UseTelephonySoftPhone |
| A control is missing | The provider must advertise the TelephonyCapabilities flag and implement the matching contract |
| Settings change ignored until restart | Code reads IOptions<TelephonyProviderOptions>; switch to IOptionsMonitor |
| Dial refused for a short code | Add it to Allowed short codes (emergency codes can never be allowed) |
| Hub URL wrong behind a tenant prefix | Use Html.SignalRHubUrl<TelephonyHub>() |
| Call stays connected after the far end hung up | The provider must normalize its events into ProviderVoiceEvent and implement ITelephonyCallStateProvider |
Related Skills
orchardcore-telephony-telnyxandorchardcore-telephony-asteriskfor the built-in providers.orchardcore-contact-centerfor queues, routing, the dialer, recording governance, and Contact Center voice provider adapters.orchardcore-signalr,orchardcore-websockets,orchardcore-phone-numbers,orchardcore-dnc-registry.orchardcore-admin-lists,orchardcore-site-settings,orchardcore-configurationfor the framework mechanics.