1

I am creating a new extension to add a new SMS provider. Since different parameters are passed during callback, I need to override run method of the CRM_SMS_Page_Callback class. Since it is a part of CRM Core, what is the best way to do it?

sites/all/modules/civicrm/CRM/SMS/Page/Callback.php

class CRM_SMS_Page_Callback {

  public function run() {
    $provider = CRM_SMS_Provider::singleton($_REQUEST);

    if (array_key_exists('status', $_REQUEST)) {
      $provider->callback();
    }
    else {
      $provider->inbound();
    }
  }

}
0

When you say parameters do you mean http get/post parameters? You would just access those in your callback the usual way in php. Or see for example the callback function for clickatell

https://github.com/veda-consulting/org.civicrm.sms.clickatell/blob/master/org_civicrm_sms_clickatell.php

  • Yes, I mean GET parameters. My SMS provider does not use 'status' parameter necessary for the callback() method to fire. – Djordje Marjanovic Dec 12 '17 at 19:38
  • Then in your inbound() function you could also branch and call callback() as necessary. – Demerit Dec 12 '17 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.