Usually, the GSM gateway is not able to know the number of the sims.
And you cannot set callid through the way of setting origination_caller_id_number, because the callerid is controlled by the operator, even if you send the true number that this sim card is suppose to have.
There is a tricky way to let your service know which number you are using to call, that is to set the voip account by the number.
the original integration between FS and GSM gateway could be like this:
FS ------(sip trunk)------> GSM gateway
the sip trunk is a voip account set in GSM gateway, and there is a routing rule goes from this account to all your sim cards.
Now we do some tricky changes, setting multi sip trunks by the number,
FS ------(number A sip trunk) ----> GSM gateway (only route to sim A)
| ------(number B sip trunk) ----> GSM gateway (only route to sim B)
| ------(number C sip trunk) ----> GSM gateway (only route to sim C)
you got 32 sim cards, and there should be 32 sip trunks.
and then you will know the number since each call goes through one sip trunk.
By the way, you need to do the dispatching job on the higher level of your service, some Higher Business Layer which controls FS to do callings should take over the dispatch functionality that is originally handled in the GSM gateway.