In CRM_SMS_Provider::processInbound, there are the lines

'source_contact_id' => $toContactID,
'target_contact_id' => $fromContactID,

which suggests that the source contact of the activity will be 'us', and the target will be the remote contact, who sent the message.

This is not the same as Inbound Email, which in _civicrm_api3_deprecated_activity_buildmailparams sets the source contact to the sender, and the targets as an array of recipients.

This is not going to be an issue for most users, as neither Clickatell nor Twilio extensions pass the 'To' number through to processInbound, and in this case the target will be set to the same as the source, attaching the activity to only the remote contact. It can arise if one uses a provider extension that does pass the 'To' number to processInbound, or Clickatell or Twilio have been appropriately modified, for example so messages received on multiple inbound lines can be told apart.

Should the source contact be the sender?

  • Previously asked on the forum: forum.civicrm.org/index.php?topic=35756.0 I'm trying to clear out old issues on our bug tracker here at FF.
    – DaveFF
    Nov 25, 2015 at 11:27
  • Another custom thing we've done in CRM_SMS_Provider, is checking for duplicate message tracking IDs and bodies on inbound messages- in a couple of cases we had a message hit us more than once from the provider.
    – DaveFF
    Nov 25, 2015 at 11:34
  • I have thought of the exact same thing. It seems weird that source and target contacts are the same, since that does not reflect real life action.
    – Flying
    Nov 25, 2015 at 12:03
  • @DaveFF for an example of "messages received on multiple inbound lines can be told apart" see inbound() in github.com/HikerBoricua/org.civicrm.sms.twilio/blob/master/…. It lives with the from/to direction as is, would have to change if Core is updated. Our use case is precisely what you said, each Twilio phone number receives inbound texts for a specific staff person.
    – wil_SRQ
    Aug 7, 2020 at 20:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.