Altering number received from Caller ID

I have setup caller ID using a USB modem the same way as for many other setups I’ve done, however on this one the number is being formatted differently by the phone company, like this

01234-567890

I want to remove the - from the number before passing to the entity screen, so that the number is saved as

01234567890

Normally I would’t care as much, but we have integration with GloriaFood on this same setup as well as loyalty cards linked to the customers, therefore if we have numbers coming in for phone orders with - and online orders without, we are going to get duplicate customers and problems with our loyalty setup.

Since we can match the phone number correctly coming from the modem, we just need to remove the - before it is sent to the entity screen. The “Search Format” field seems to be the obvious place to try things:

image

I have tried regular expressions and various other things, some do nothing, others crash SambaPOS. The only thing I can get to work in this field is {0} which of course just passes the number as is. So it looks like the field only lets you do things like prefix / suffix, etc., e.g. ABC {0} DEF.

I can’t find anything solid about this field on the forum. I searched online using some info from one of the errors I got when SambaPOS crashed and found information about C# handling of formatted strings, which it appears this is. However if following the info on that site, I should be able to either use {0:N} or {0:###########} to format the number without the - (the first forces it to a number, the second forces each character to a digit). However, neither work - they don’t throw any error but they just display the number with no change.

I then looked at the Entity Screen, specifically the “Search Value Replace Pattern”, which I assume needs to be a regular expression.

I have tried a few but can’t get anything to work, it is like it does nothing. There is again no info on the forum about this field.

Does anyone have any suggestions what I can do here? Or what values I could possibly try in those fields?

Thanks! :slight_smile:

Never use USB CID Device, but normally is it display popup and then when popup click it go to entity screen?
In display popup you can remove - before passing to entity screen.

How?

It displays the popup, you click it and it then enters the phone number into the search field of the entity screen.

The standard setup doesn’t have any rules where we can alter the number going to the popup or entity screen other than the settings I mentioned above. The only other option is possibly capturing with the Device Event Generated event in a rule and bypassing the default behaviour, but I was keen to know if I can accomplish what I need to without having to do that.

Can you show me your Display popup?
You can use .replace(/-/g,’’)

Nope :frowning: It doesn’t parse the function

Try replace(’-’,’’)
I’m not sure why using / / won’t work sometime.

You can also {CALL:X} it will work for sure.

No, you are not understanding where this is happening. This is not in a rule. The caller ID setup uses the caller ID module that adds a device in Local Settings. For a normal setup, we don’t need any rules or actions to make it work - the device module does it all. That is where the first screenshot comes from. The only places I can see to affect what goes to the entity screen is either the “search format” field on the device settings, or the “search value replace pattern” on the entity screen settings.

So I tried calling a JS function with {CALL:X}, as expected SambaPOS crashes. It is expecting only {0} in that field if using {}, the field appears to support no tags, functions or regular expressions.

OK, what I’m talking about is Display Popup action. If it doesn’t use it you can’t modify it then. Is it hard code?

The popup looks something like this. This is generated by the caller ID module and the Generic Modem device in Local Settings > Devices.

I know I mean the display popup action in the rule. But you said it doesn’t have one so, it is hard code so, i have no idea.

Yeah it’s hard coded, it’s part of caller ID module. It adds a few devices. You can build you own custom setup as well by using the Device Event Generated event, but I was hoping there was a more simple approach.

Another thing putting me off going right in and doing my own custom setup is using the default functionality, it works well for a real life setup - if the user is working on a ticket, it won’t display the popup until they close the current ticket, thus not obstructing their view. But if I write my own, I am not sure if it will behave in the same way. If it pops up during a ticket, it is not much use - imagine if you are serving a walk in customer and the phone rings, and if you get a popup and dismiss it, you lost their number.

You can take a quick look here for reference, this is how it is setup normally.

IIRC yes it is behave the same way. I think it is the way Display Popup work. It is not hard code in Caller ID setup.

I used to have one with VOIP but a lot of ppl use one number to call and give another one when I ask their number. It is annoying having to click popup and delete the number and ask their phone again because I’m not ready to type new number in. So, I just not using it.

I’m going to test it now, I think it’s the only way I can have access to alter the phone number. Quick test with show message and found the default popup shows as well, but found this trick to hide the default popup:

Maybe you can try Trim Chars but I think only for prefix and suffic or Match Pattern :wink:

No those are only related to capturing the number.

My plan when I asked that was to pass the number straight into the script without popup.
If you can do that you should be able to do anything in the script and then pass the fixed number or whatever on into your automation.

I’ve tried to create my own popup and it works so far - it resolves the original issue that I can of course remove the hyphen from the number. However, I don’t have the same level of control about how the entity search happens. With the default caller id behaviour, I can select the department, however if I create my own rules, there is no way to do an entity search and specify the department. Ticket type isn’t enough. Also I have tried Load Entity and Change Ticket Entity to pass to the entity search but I end up with a ticket being created before going to the entity screen.

Is there a way I can just navigate to my entity search screen whilst also specifying the department?

My setup comprises of 2 departments - one for take away and one for delivery/collection. Take away doesn’t use customers at all and uses “create ticket” ticket creation method. I don’t want to change this. Then for delivery/collection I am using “select entity” ticket creation method. However if I am in the take away department when the call is received, it will try (and fail) to load the customer entity screen. Even if I allow that entity screen on the take away department, I then end up in the wrong department.

So if I look back at the original default behaviour, is it possible to use a regular expression match pattern that would also remove the hypen - as part of the match, or is that not possible? I’ve been spending hours trying to figure ways to do this, but regular expressions are not my strong point! I tested a few combinations and it looks like it’s not possible though.

@markjw, hi did you find any solution , also i used to use a usb modem it was saving fine line 00123456 , when i changed to different provider now the caller id shows from 23456 , also having gloria setup online orders saves like myname-00123456 format. the problem here lot of duplicate customers which i cannot delete due to used by ticket, and it wont select customer because of matching numbers

  • Is there anywhere i can change gloria saving format with only phone numbers ?
    did you managed anything ? what i ant to do is make all customers in uniform save with only phone as primary field . thank you

No

This sounds more like the device isn’t showing the whole number. Have you tested with Putty?

This cannot be changed and it’s always been a frustration for me, as for the same reason I can’t use the Gloriafood integration as I want the customers to sync and not have duplicates.

It’s not possible at the moment with the Gloriafood integration. Maybe you can send a request to support@sambapos.com and ask if they can add as a feature request in the future