E-mail & callback

The two methods that reach outside the database: sending a templated e-mail, and starting a call-back.

email_send

Sends one of the installation's saved e-mail templates to an account's registered address.

Who may call it: admin, accountant or reseller — not a plain user, not a partner.

ParameterRequiredIn hashMeaning
uYes—Caller's username — must itself have a registered e-mail address, since the template is sent as that account.
email_nameYes1stName of the saved e-mail template.
email_to_user_idNo2ndRecipient account id. Left out, sends to the caller's own address. A reseller can only target their own customers (or themselves).
anything elseNoonly if the name happens to be in the shared listPassed through as template variables — only the ones the template actually recognises get substituted.

Hash parameter order: email_name, then email_to_user_id.

curl -X POST https://api.example.com/api/email_send \
  -d "u=admin" \
  -d "email_name=welcome" \
  -d "email_to_user_id=3031" \
  -d "hash=PLACEHOLDER_HASH"
<page>
  <email_sending_status>1</email_sending_status>
</page>

Note the success tag sits directly under <page>, not nested in <status>. Errors are nested — <page><status><error>...</error></status></page>: Bad login, Dont_be_so_smart (wrong account type), Email not found (no such template), Your email not found (the caller's own address is missing), User not found (recipient outside scope), User email not found (recipient has no address), or whatever the mail system itself reports.

Also reachable as: /api/send_email.

Email templates — email_send sends one of these saved templates by name.

callback_init

Starts a call-back: the system calls src first, and once that leg answers, dials dst. Only works if the installation has switched callback on (confline CB_Active).

Who may call it: any account type, provided the device named belongs to their own scope.

ParameterRequiredIn hashMeaning
uYes—Caller's username.
deviceYes1stNumeric device id that provides the calling identity — must be in the caller's own scope.
srcYes3rdThe number called first (e.g. the customer's mobile).
dstYes2ndWhat gets dialled once src answers. There is no "ask the caller what to dial" fallback here, so this is mandatory even though earlier versions of this API could leave it out.
callback_uniqueidNo—1 asks for a generated callback id back in the response.

Hash parameter order: device, dst, src — note the shared list puts device first and dst before src, not the order you'd read them in a sentence.

curl -X POST https://api.example.com/api/callback_init \
  -d "u=demo_customer" \
  -d "device=3327" \
  -d "src=41440000011" \
  -d "dst=41440000099" \
  -d "hash=PLACEHOLDER_HASH"
<page>
  <Status>Ok</Status>
</page>

Note the capital <Status> — that's how this one method spells it, both on this plain-success shape and on every error. The only time it's lower-case is when you pass callback_uniqueid=1: then a success answers <page><status>ok</status><callback_uniqueid>...</callback_uniqueid></page> instead.

Errors (all in capitalised <Status>): Access Denied (callback switched off, or no caller), src is missing, dst is missing (ask-IVR is not wired on this system), Device was not found, Dont_be_so_smart (device outside scope), Cannot_connect_to_asterisk_server (a literal, untranslated key).

Callback settings — the CB_Active switch and the CallerID fields callback_init relies on.