MOR and M4 API: what you can automate before you sign

6 min read

MOR and M4 API: what you can automate before you sign

You can create the account, change the balance, record a payment, and pull the call list on both MOR and M4. You can assign a DID, a phone number, on MOR. You cannot push call records in, and you cannot send a supplier price file through the API. Access is included on every plan, including a hosted system, so there is no separate fee. The check before a pilot is a method name for each call the portal will make, because a missing method shows up after the integration week is already on the calendar.

This is for the person who has to connect a customer portal, a CRM, or an ISP billing system to MOR or M4 before a contract. That system has to do the work with nobody logged into the GUI.

One buyer wrote: “I do require an API. Does your system include this?” Another wrote: “CDRs accessible through an API. Provisioning of customer trunks via GUI or API.” A CDR is the record of one call.

What the portal can already call

A customer screen needs five jobs, because it has to open an account, take money, price the call, hand out a number, and show what happened. MOR’s older API lists 136 methods. M4’s older API lists 32. Both answer in XML, and both products also have a second API, version 2. On MOR a new portal uses both, because the older API does the writes and version 2 adds the newer reads. There is no published end date for the older methods.

Job MOR M4
Create the account user_register creates the user. device_create creates the phone or the trunk. Version 2 does not create either. user_create creates the user. cp_create creates a connection point, which is M4’s name for that endpoint.
Move money user_balance_update changes the balance. payment_create records a payment. A top-up that only changes the balance has not recorded a payment. The same two methods.
Prices You can read a rate, and you can post retail prices in the format that method defines. You can read rates.
Numbers did_create and did_device_assign create a DID and attach it to a device. Version 2 can list DIDs for an admin or an accountant, and it cannot create or assign one. Number pools only. No method creates a DID or assigns one.
Calls user_calls_get returns calls for a time window you choose. active_calls_get returns calls that are up now. user_calls_get returns calls for a time window you choose.

A “client pool” on a buyer’s checklist is a number pool: you create the pool, then add or remove numbers. A list of customer accounts is users_get.

A monthly charge log is the request that is not in the table. MOR can list subscriptions, invoices, and payments, so you can see that a subscription exists and that an invoice was issued. None of those is a line for each monthly charge. M4’s index has no invoice method, so the same log is missing there too. If the portal has to read that log, name it with the calls you send before a pilot.

How a call is authenticated

The older API is a POST to /billing/api/ plus the method name. A hash authenticates the call. The hash is a SHA1 checksum of the values in a fixed order, with the API secret on the end, so the server can reject a request that was not signed with that secret. The username is not part of the string. For a balance change the order is the user id, then the balance value, then the secret.

Send one test amount and read the balance back before a top-up button uses this method. The balance method describes that field as the new balance, and it also describes an increase or a decrease, so one reading is not enough.

Version 2 uses a login token instead of that hash. You log in with the GUI password, which is not the API secret, and later calls send the token. The list of version 2 methods on a given server is the page at /billing/api/v2/api-docs/. On M4 the access token lasts 15 minutes. The refresh token lasts 7 days, and the portal exchanges it for a new access token, so it does not send the GUI password on every call.

MOR X18 is the limit on that second API. On X18, version 2 can log in and can hang up active calls, and the other version 2 methods are not there. The calls list starts on MOR X19, so a portal that needs the JSON call list has to be on X19 or later. A server still on X18 keeps user_calls_get.

A pull every few minutes, or a look at calls that are up

A buyer wrote: “We can retrieve CDRs every 5–10 minutes, but we need real-time call visibility for support purposes.”

That request is two jobs, because a list of finished calls does not show who is on the phone right now.

The few-minute job is user_calls_get, called on a timer, on MOR or on M4. Where version 2 calls is available, that list can come back as JSON. If the portal wants a file instead of a page of records, MOR version 2 can schedule an export. The periods are hourly, daily, weekly, every two weeks, monthly, or once. The shortest of those is hourly, so a pull every 5 to 10 minutes stays on user_calls_get. Creating the task does not return the file, because the scheduler writes it when the task is due, and a later call downloads it. An admin account creates the task.

The support screen is the other job. active_calls_get on MOR returns the calls that are up for that user when you ask, so you poll it. The answer is a list of calls, not the audio, which means support can see who is in a call and cannot listen to it from this method.

A webhook is how the switch tells your system that something already happened. The field list is in Webhooks in MOR and M4. Call End is MOR only, and it is the one that matches a finished call. You set a URL on the source device. MOR looks for finished calls about every 10 seconds and puts the fields on the query string, with an empty body. The first run does not send old calls, and a call older than about two hours is left out, so Call End tells the portal that a call has finished. It does not show the call while it is still up. That is why the live screen stays on active_calls_get.

Warning Balance is also MOR. The check runs hourly, or at the time of day set on the user, and the body is empty, so it can warn you that a balance crossed a line. It cannot tell you that a call ended. Alerts are the push that exists on both MOR and M4. The body is JSON, sent when an alert is raised or cleared.

What you cannot push in

No method inserts a CDR. If the portal has to push call records in, that call is missing, and the import is a file upload in the GUI. On MOR you upload a CSV under Settings → Billing → CDR → Import, and MOR rates those rows the same way it rerates calls, so the file can become the customer’s charge. On M4, Billing → CDR → Import uses a CSV column template. This article does not treat that M4 file as the customer charge.

No method accepts a supplier spreadsheet of prefixes and prices. On MOR, retail prices go in as XML, or by destination group on version 2, which is a named set of prefixes. Neither of those calls accepts the supplier’s CSV or XLSX. The wholesale method on MOR and on M4 only creates or renames the tariff and sets the currency. It does not load price rows. A supplier file goes through the CSV import, which needs a prefix column and a price column, or through the Automatic Tariff Import add-on. The add-on reads an email attachment on MOR and on M4, and a person confirms the import before the prices go live. It is a separate module, so name it if you want it on the quote. The 4-week pilot imports one or two files by hand. It does not build the API client.

Turn the API on, then decide who may call it

The API stays off until an API secret is saved, because both products refuse to enable it without one. On MOR the screen is Settings → Setup → Settings → API. On M4 it is Maintenance → Settings → API settings. Allow API globally has to be on. Leave Allow GET API off on a production server, because that switch is for a browser test and the screen marks production use as unsafe. Leave hash checking on. That is the default.

On MOR, an accountant or a plain user can be limited to a permission group under Settings → Setup → API Permission Groups. A new group starts with every method off, so you turn on Read for a list and Write for a change such as creating a DID. The limit applies when API restricted is on for that user. Admin and reseller accounts do not get that checkbox. They use the hash, and the reseller still needs the admin to have allowed the API. Turning the API on does not hand a customer login every method.

An IP limit is optional, and it stays off until you turn it on. With it on, a call is accepted only from a whitelisted address marked Allow API access. If the restriction is on and no address is marked, every call is denied, including the portal’s, so mark the portal’s address in the same change.

A missing method is a separate quote

Start with a method that already exists. One buyer with a working billing panel wrote: “API integration is possible, but we prefer built-in modules or already available integrations instead of custom development.” When the portal needs a module that is not in the list, Kolmisoft treats an API method for that module as priority work. That work is custom development. The quote covers the new method. It is not a fee for the API.

Send the calls before a pilot

A pilot lead wrote: “We’d also like to test the API functionality.”

Name the calls the portal has to make. That is a better test than reading every method name. Reply on the contact page with those calls, in plain language. Three are enough to start: create a user, add a payment, list today’s CDRs. Add “assign this DID” when the portal does that too. We will map each one to a method, or tell you it is not on the API, before any pilot.


Send the three calls before a pilot

Contact us with the three calls your portal must make. We will map each one to a method, or tell you it is not on the API, before any pilot.

Contact us

Leave a Reply

Your email address will not be published. Required fields are marked *